Dear friends!

Can anyone tell me how can I connect an additional data query I created inside the tableadapter (inside dataset-editor) to a combo box list? So I will actually see the data in list. I managed to create a query inside tableadapter, which only contains data from one column of connected table.

I’m now trying to find the way to connect combobox with this query’s data.

?????


Any reply is very much appreciated


Many thanks in advance…

Hi kdee,

You could try something like this:

Private Sub PopulateFromData()
'Assuming your dataset is called Data1
'and your ComboBox is called Combo1
   Combo1.Clear 'If you want to start with a blank ComboBox
   While Not Data1.Recordset.EOF
      Combo1.AddItem Data1.Recordset.Fields("<your field name>")
      Data1.Recordset.MoveNext
   Wend
End Sub

Hope this helps

Happy coding

Yomet

Thanks Yomet!

I'll try this and see if it succeeds. :rolleyes:

Thanks many times for your reply. :)


I'll post my findings anyway.


Be well


kdee

desperately need answers man!

i want to go from one window to another depending upon the text/item in the combo box

here part of the code in visual studio:-

private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {

here is what i want:-

    private void button1_Click(object sender, EventArgs e)
    {
        AdminMenu admin = new AdminMenu();
        TeacherMenu teach = new TeacherMenu();
        StudentMenu stud = new StudentMenu();

        if (comboBox1.Text = "Administrator"){
            admin.Show();
        }
        else if (comboBox1.Text = "Teacher") {
            teach.Show();
        }
        else if (comboBox1.Text = "Student") {
            stud.Show();
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.