Hi everyone. I have a VB.NET form with a couple of comboboxes on them who get their drop down entries from a database. Now I'm really confused as to why the program behaves in an odd way.
Since I have multiple forms which have comboboxes I made a method in my main class that fills the comboboxes with the necessary information. The method definition is as follows
Public Shared Sub filler(byref box as combobox, byval query as string, byval name as string)
Now the function just executes the "query" and creates a dataset that contains a table named "name" and fills a dataadapter with the dataset. Then I just set the combobox.datasource and displaymember fields to the necessary stuff and yeah thats it.
So in my forms on the form_load event I call this combobox filler method and everything works fine, but the problem is that despite writing stuff like
combobox.selectedindex = -1
combobox.text = ""
the combobox always starts up with something in it, but if I click a button that would perform a certain function depending on what the value of the combobox is and then write the same aforementioned clearing code, it works!!
So yeah I'm pretty much confused. Any help would be appreciated!