VB
An object-oriented programming language developed by Microsoft that is implemented on the .NET Framework. Previously known as Visual Basic .NET.
2,714 questions
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
I want to add the "cut" and "paste" feature to a ComboBox, and I am not finding the code for it. Can anyone provide me with "Cut" and "Paste" codes for ComboBox.
For a standard ComboBox, add a ContextMenyStrip to the form, add menu items, add code then set the ContextMenuStrip property of the ComboBox to the new ContextMenuStrip.
Code for copy and cut (you can figure out the rest)
Private Sub CopyToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles CopyToolStripMenuItem.Click
Clipboard.SetText(ComboBox1.Text)
End Sub
Private Sub CutToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles CutToolStripMenuItem.Click
Clipboard.SetText(ComboBox1.Text)
ComboBox1.Items.RemoveAt(ComboBox1.SelectedIndex)
End Sub
Following this link for other Clipboard methods
https://video2.skills-academy.com/en-us/dotnet/api/system.windows.forms.clipboard.settext?view=net-5.0