Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copy from ComboBox to Clipboard

Status
Not open for further replies.

Andrzejek

Programmer
Jan 10, 2006
8,486
5
38
US

On my Form I have a combo box that has Style property set to 2 - DropdownList. Users can only select from it, they cannot type in it.

So I have something like this in my code:
Code:
Option Explicit

Private Sub Form_Load()

With Combo1
    .AddItem "Andy"
    .AddItem "Cheryl"
    .AddItem "Kim"
    .ListIndex = 0
End With

End Sub
Now my users want to be able to copy what's in the combo box into the clipboard so they can paste the entry somewhere else. In the combo box there are Project Numbers that are more complicated that the names I displayed here. They just don't want to re-type what they already see in the combo box. Makes sense to me.

I was hoping to use MouseDown event with the Right-Click to copy text to clipboard, but there is no MouseDown for combo box.

How can I copy what user selected from my combo box to the clipboard?

Have fun.

---- Andy
 
You certainly can obtain the combobox item in the Click event. In the Click event the code would simply be:

Clipboard.SetText Combo1.Text

 

Thank you. I just don't want to overwrite whatever is in Clipboard every time somebody changes the selection in the combo.

I ended up with a separate command button and that is where I assign a few lines of data to a Clipboard.

Thanx anyway :)

Have fun.

---- Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top