Hi all, i need some help... I have an application, with some controls and 3 comboboxes filled with countries, states, cities from 3 tables... What I need help in is that how can i relate the comboboxes or the table that are behind them, so when i click the the countries combobox for example, when i click Greece, then in the second cmb only the states of greece appearing..
Need help !!!
Vijaya KadiyalaPosted Apr 9, 2008, 1:07 PM
Hi,
The only what that you can link all these different combo-boxes are based on the _OnChange Event. base don your requrirenemt, If one selectes the Greece in the country dorpdown, you want to populate states in another dropdown, that means in the _OnChange event you need to poulate the Sate dropdown box...
Thanks -- Vj
http://dotnetvj.blogspot.com
Bechir BejaouiPosted Mar 23, 2008, 8:31 AM
Here is an example:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ComboBox1.Text = "Greece"
ComboBox1.Items.Add("Greece")
ComboBox1.Items.Add("Tunisia")
ComboBox1.Items.Add("Italy")
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
ComboBox2.Items.Clear()
ComboBox2.Text = ""
If ComboBox1.Text = "Greece" Then
ComboBox2.Text = "Athina"
ComboBox2.Items.Add("Athina")
ComboBox2.Items.Add("Esparta")
ComboBox2.Items.Add("Rhodes")
End If
If ComboBox1.Text = "Tunisia" Then
ComboBox2.Text = "Tunis"
ComboBox2.Items.Add("Carthage")
ComboBox2.Items.Add("Tunis")
ComboBox2.Items.Add("Utica")
End If
If ComboBox1.Text = "Italy" Then
ComboBox2.Text = "Rome"
ComboBox2.Items.Add("Rome")
ComboBox2.Items.Add("Napoli")
ComboBox2.Items.Add("Palermo")
End If
End Sub