We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Combobox Issues

Thread ID:

Created:

Platform:

Replies:

11239 Feb 27,2004 03:08 PM Windows Forms 0
loading
Tags: FAQ
Mehul Malhotra
Asked On February 27, 2004 03:08 PM

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!

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;