Menu, Popup Menu, Cut, Copy, Paste and Delete options in VB.Net

Опубликовано: 10 Октябрь 2024
на канале: Windows Techies
1,454
15

The most popular option of any windows program are Menu, Popup Menu, Cut, Copy, Paste and Delete options. In this video we are going to learn how to add Menu, Popup Menu, Cut, Copy, Paste and Delete functionality in Microsoft Visual Studio. You can check out the code below or visit my blog www.websofttuts.com.
Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
TSSDate.Text = Date.Now.ToShortDateString
txtEditor.Text = "Hello welcome to my world!"
End Sub

Private Sub HelpToolStripMenuItem1_Click(sender As Object, e As EventArgs) Handles HelpToolStripMenuItem1.Click
MessageBox.Show("Help is available here!", "Help", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub

Private Sub Form1_MouseDown(sender As Object, e As MouseEventArgs) Handles Me.MouseDown
If e.Button = Windows.Forms.MouseButtons.Right Then
ContextMenuStrip1.Show(Me, Me.PointToClient(MousePosition))
End If
End Sub

Private Sub txtEditor_TextChanged(sender As Object, e As EventArgs) Handles txtEditor.TextChanged

End Sub

Private Sub CopyToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles CopyToolStripMenuItem.Click
My.Computer.Clipboard.SetText(txtEditor.SelectedText)
End Sub

Private Sub PasteToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles PasteToolStripMenuItem.Click
txtEdited.Text = txtEdited.Text & My.Computer.Clipboard.GetText

End Sub

Private Sub CutToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles CutToolStripMenuItem.Click
My.Computer.Clipboard.SetText(txtEditor.SelectedText)
txtEditor.SelectedText = ""
End Sub

Private Sub DeleteToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles DeleteToolStripMenuItem.Click
txtEditor.SelectedText = ""
End Sub
End Class


If you would like to see more of those videos, let me know in the comments!

Click here to subscribe to my channel:
   / @sarfarazbhat  

Click here for Visual Basic.Net Playlist:
   • INSERT, READ, EDIT, DELETE (CRUD) VB....  

you can always download source code of my videos on my blog:
http://www.websofttuts.com/

Follow me on social media:
  / websofttuts  
  / sarfarazbhat  
https://plus.google.com/+sarfarazbhat
  / sarfarazbhat