By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 897 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

how to display all items from combobox to textbox when selected one item in combobox

P: 2
Hi,
I have a combobox with some comments in it .when we select any one item in combobox all the items should be displayed in textbox. please help me with code.

Thanks
Jan 18 '08 #1
Share this Question
Share on Google+
1 Reply


kadghar
Expert 100+
P: 1,295
Hi,
I have a combobox with some comments in it .when we select any one item in combobox all the items should be displayed in textbox. please help me with code.

Thanks
Im not understanding quite well, but, what you want to do is to display all the items of the combobox in the text box when you select any one item of the combobox??
lets say your combobox has Item1, Item2, Item3 and Item4

so when you select Item2 in the combobox, the textbox shows Item1, Item2, Item3, Item4 ?? separated by.. lets say commas

just write this in the validate (or change) event of the combobox:

Expand|Select|Wrap|Line Numbers
  1. dim i as long
  2. textbox1.text = ""
  3. for i = 0 to combobox1.listcount -1
  4.     textbox1.text = textbox1.text & combobox1.list(i) & ", "
  5. next
  6. textbox1.text = mid(textbox1.text,1,len(textbox1.text)-2)
this particular case has a lot of sintax that change from one to other version of VB, next time try to tell us what version you're using.
well HTH
Jan 18 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.