How do you link an item to a item in a combobox
Can someone point me to an example on how to link some items in textbox's to an item in a combo box when it's selected or show how it's done please.
I have five textbox's with variable data in them and they need to associated to an item in the combo.
Re: How do you link an item to a item in a combobox
Can you clarify your question please.
Re: How do you link an item to a item in a combobox
This question is not that clear but anyhow, each items in ComboBox has an INDEX associated with it. You can save this INDEX into the TEXTBOX .Tag properties or something like that to link that TEXTBOX with the item in the ComboBox.
-Cool Bizs
Re: How do you link an item to a item in a combobox
Ok, thank you Cool Bizs. I'll have a go but do you know if there is an example somewhere?
Thanks
Re: How do you link an item to a item in a combobox
I can give you a sample code on assigning the INDEX property of the combobox to the TAG property of the textbox but not sure if it applies to what you are doing right now.
private Sub cmbItem_Click()
' assign listindex to the TAG so that we know which item to modify later
if (cmbItem.ListIndex <> -1) then
txtModifyItem.Text = cmbItem.List(cmdItem.ListIndex)
txtModifyItem.Tag = cmdItem.ListIndex
end if
End Sub
private Sub txtModityItem_LostFocus()
' check if text is different from original value
if (cmbItem.List(cint(txtModifyItem.Tag)) <> txtModifyItem.Text)) then
' should confirm if user wants to save changes
cmbItem.List(cint(txtModifyItem.Tag)) = txtModifyItem.Text
end if
End Sub
Hope this helps,
-Cool Bizs
Re: How do you link an item to a item in a combobox
Yes, thank you Cool Bizs, That is what i am trying to do. I'll give it a try and see if it will work ok.
Thank you very much.
Re: How do you link an item to a item in a combobox
Hi Cool Bizs
I have been mucking around with this for the last couple of nights and it's close to what i want i think.
What it's doing is putting the item in the combo box (a company name) into the text box, which isn't quite what i wanted to happen.
What i have is a combo box and five textbox's. The combo holds a company name and the textbox's hold the address of the company, when i select a company name in the combo i want the textbox's to show the address of that company.
I hope that is a little clearer this time.
Your code is close to what i need but i can't quite get it the rest of the way.
Can you help please?
Re: How do you link an item to a item in a combobox
Sorry for this late reply. Anyway, I've coded a little sample for you:
http://coolbizs.20m.com/CodeGuruHelp...d/ccdriver.zip
Be sure to scan for viruses (i've done that 3 times before i uploaded it to the network) just in case the web space is not virus-free.
-Cool Bizs
Re: How do you link an item to a item in a combobox
Hmmm, i get a permmission denied for access when i click on that link, Cool Bizs
Maybe somethings gone funny here, i'll try again tomorow.
Re: How do you link an item to a item in a combobox
Send me email personnally and i'll send you the package.
-Cool Bizs