Solved

i have problem with comboboxes

Posted on 2004-10-18
4
159 Views
Last Modified: 2010-04-23
Dear Experts,

i need a solution to the above problem.
I have two combobox the first combobox called Periphery and the second called county.
I want to do this : When i select a specified periphery from the first combobox i want the second combobox to give the specified county which belongs to the periphery..

the periphery and county get the fields from the tables from the database..
Please i need help...
0
Comment
Question by:dakanali
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 10

Accepted Solution

by:
123654789987 earned 25 total points
ID: 12337216
U can see the following link. It shows the relationship between a combobox and a listbox. U can implement the same with two comboboxes

http://codeproject.com/cs/miscctrl/valuemembersample.asp
0
 
LVL 19

Assisted Solution

by:arif_eqbal
arif_eqbal earned 25 total points
ID: 12337321
On SelectedIndexChanged of first ComboBox write the code to populate the other Combo


    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged


        Dim DR As OleDbDataReader
        Dim Cn As OleDbConnection = New OleDbConnection(YourConStr)
        Cn.Open()
        Dim Cmd As OleDbCommand = New OleDbCommand("Select YourCol From Yourtable Where AnotherCol='" & ComboBox1.Text & "'", Cn)
        DR = Cmd.ExecuteReader
        Do While DR.Read
            ComboBox2.Items.Add(DR(0))
         Loop

        DR.Close()
        Cn.Close()

End Sub


However this will require a roundtrip to the dataBase so you can as well store all data in a dataTable and locally populate the combobox

0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

624 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question