|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
combobox on form loadI have a combo box that I want to populate, based on the selection of another combo box. So when combo box A is selected, combo box B is populated with related values. I have this all working fine, except for on the forms loading. I have combobox B being populated after combobox A_SelectedIndexChanged event fires. However, on the form load, when I try to retrieve the value from "selectedvalue" , field, it is giving me "System.Data.DataRowView". that is the field isnt populated. I dont understand why there is no value if the selectedindex changed event is firing? Can someone advise how I should be handling this. Even when the combo box isnt yet populated, the selected index is showing as zero?. thanks Ausclad,
I have answered your question in another newsgroup. Cor Show quoteHide quote "Ausclad" <Ausc***@discussions.microsoft.com> schreef in bericht news:CAF6F9AC-1D66-4652-8168-6C6CBFBB4FC7@microsoft.com... > Hi, > I have a combo box that I want to populate, based on the selection of > another combo box. > > So when combo box A is selected, combo box B is populated with related > values. > > I have this all working fine, except for on the forms loading. I have > combobox B being populated after combobox A_SelectedIndexChanged event > fires. > > However, on the form load, when I try to retrieve the value from > "selectedvalue" , field, it is giving me "System.Data.DataRowView". that > is > the field isnt populated. > > I dont understand why there is no value if the selectedindex changed event > is firing? > > Can someone advise how I should be handling this. Even when the combo box > isnt yet populated, the selected index is showing as zero?. > > thanks > > Try the following code. take two comboboxes and use the following code.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ComboBox1.Items.Add("First") ComboBox1.Items.Add("Second") ComboBox1.Items.Add("Third") ComboBox1.SelectedIndex = 0 End Sub Private Sub ComboBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.TextChanged If ComboBox1.Text = "First" Then ComboBox2.Items.Clear() ComboBox2.Items.Add("a") ComboBox2.Items.Add("b") ComboBox2.Items.Add("c") ComboBox2.SelectedIndex = 0 ElseIf ComboBox1.Text = "Second" Then ComboBox2.Items.Clear() ComboBox2.Items.Add("d") ComboBox2.Items.Add("e") ComboBox2.Items.Add("f") ComboBox2.SelectedIndex = 0 ElseIf ComboBox1.Text = "Third" Then ComboBox2.Items.Clear() ComboBox2.Items.Add("g") ComboBox2.Items.Add("h") ComboBox2.Items.Add("i") ComboBox2.SelectedIndex = 0 End If End Sub
VB Express SQL Express Remote Connection
Trouble with "Process's" please help! .NET equivilant of isnumeric copy HTML information Datagridview Search? How to open a text file only through my application but not others? Text missing from RadioButtons in Groupbox Implementing an interface? Printing in VB.Net can I use Imports with a VB2005 class namespace? |
|||||||||||||||||||||||