Good Morning Friends

I Am Using VB.net,I am doing code for search button & it's working for textboxes but not for combobox,accualy when it get any value so it shows on textbox by using

textbox1.text=ds.tables(0).rows(0).item(0)

& it shows but when i use

combobox.text =ds.tables(0).rows(0).item(0)

it doesn't show any value but when i wright

combobox.selecteditem==ds.tables(0).rows(0).item(0)

it works but execution get transfer because i have wroght code on comboboxselectedindexchanged

please give me any solution

Maybe that because there is already items in the combo, so Try to add the value you want to the combo first

ComboBox.Items.Add(ds.tables(0).rows(0).item(0))
ComboBox.Text = ds.tables(0).rows(0).item(0)

hth

Thank's For This Code ,But when value becomes in combobox so the code of cobbobox_selected_indexchanged becomes execute & the code of that search button not execute.

you could create a flag such as Dim bIsCodeNeedToRunTrue As Boolean and set to true when you want the code in the cobbobox_selected_indexchanged to be executed and to false when not.

or you could transfer the code from the cobbobox_selected_indexchanged to click() and this way you can control if you want to the code need to be run or no, if you change the combo by mouse the code will run , if you change the code programming, you can issue

ComboBox.Text = ds.tables(0).rows(0).item(0)
ComboBox.click() ' or remove this line for not executing the code

hth

This article has been dead for over six months. Start a new discussion instead.