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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combobox Problems - To Dynamically Create or Not

Status
Not open for further replies.

Ragnarox

Programmer
Oct 2, 2003
141
US
Hello all,

I am having a problem with my combobox. I am setting its datasource to a class that I have created. Everytime that I try and reset the combobox with the following code

Code:
cmbPDFItems.Text = ""

cmbPDFItems.DataSource = Nothing

If cmbPDFItems.Items.Count > 0 Then
   cmbPDFItems.Items.Clear()
End If

the combobox does some wierd stuff. Most of the time the text portion will not clear, but sometimes the entire box clears and there is not even the drop arrow visible. The combobox also will not work like it should after the code. What I mean by that is that it fills in with the new information, but it will not fill in the text portion or have a moving highlight anymore.

So what I have thought about doing is dynamically creating a combobox and then destreoying it and making a new one when it is time to refill it. The problem is that I have a sub routine that is tied to the combobox, so I need to know if it is possible to tie the sub routine to the dcreated combobox.

This is going to be my first attempt at dynamically creating a control so any additional help or tips that I can get will be greatly appreciated as well.

Any help, as always, is greatly appreciated.

Brian
 
try refilling or resetting the dataset that the list is linked to.

Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
Christiaan,

The combobox is not tied to a dataset. It is tied to my own class that holds an arraylist of information. I do clear that one out and refill it before I refill the combobox.

Any help, as always, is greatly appreciated.

Brian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top