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. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Combobox Issues

Thread ID:




11239 Feb 27,2004 08:08 PM UTC WinForms 0
Tags: FAQ
Mehul Malhotra
Asked On February 27, 2004 08:08 PM UTC

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!


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.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon 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.Close Icon

Live Chat Icon For mobile
Live Chat Icon