I have a combobox that is populated by a SQL querry. Problem is the first item of the comboBox where normally the comboBox.text go is blank. You have to drop down the menu item for the items to appear. I want to comboBox to populated with the first item in the first row. I am currently populating my comboBox with the add property

while (oleDbDataReader1.Read() == true)
{
    comboBox1.Items.add = oleDbDataReader1.GetString(0) ;   
}

This though is skipping the first field. How can I add the first result from the query to the first field in my comboBox?

Thanks

I think if you changed the DropDownStyle from DropDown to DropDownList*
it may help you

*: from ComboBox control properties window

you may also try after filling the ComboBox control to show the first index

comboBox1.SelectedIndex = 0;

Thank you the selected Index worked fine.

Hi

I have a tabbed control. Tab1 is for adding new customer details and Tab2 is for searching for existing customers (from a comboBox) and then adding additional information for that customer.

How can I make the results of a stored procedure be automatically displayed in the comboBox(DropDownList) as soon as the user clicks on that tab?

Thanks

Elmo

Never mind, Sorted :)

Hi

I have a tabbed control. Tab1 is for adding new customer details and Tab2 is for searching for existing customers (from a comboBox) and then adding additional information for that customer.

How can I make the results of a stored procedure be automatically displayed in the comboBox(DropDownList) as soon as the user clicks on that tab?

Thanks

Elmo

can anyone say me how to insert the string of combo box into the table in oracle... from VB pls anyone help me with the code....

sqldataReader dr = cmd.ExecuteReader();\\cmd is object of sql command
while(dr.Read())
{
comboBox1,Items.Add(dr[0].ToString());
}
con.Close();\\con is a object of sqlconnection

Hi

I have a tabbed control. Tab1 is for adding new customer details and Tab2 is for searching for existing customers (from a comboBox) and then adding additional information for that customer.

How can I make the results of a stored procedure be automatically displayed in the comboBox(DropDownList) as soon as the user clicks on that tab?

Thanks

Elmo

you are using sqldatareader or sql dataadapter

rs.Open "insert into traveldet values('" & Text1.Text & "' ,'" & saccdate.Text & "','" & sretdate.Text & "','" & stype.Text & "','" & smodel.Text & "','" & Combo1.Text & "','" & Combo2.Text & "',null,'" & snopass.Text & "')", conn, adOpenDynamic, adLockOptimistic, -1

thanks friends...
this code worked for me...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.