combobox retrive data to another combobox and viceversa

Hi all you experts
I need to achive a task
when i retrive data from one combobox another automatic fill up with the related data to the field, but im also want to fill up the retrived one and the original filled up with the data.
I use this code for do the first one ok


 Private Sub part_TextChanged(sender As Object, e As System.EventArgs) Handles part.TextChanged
       
 txtNewIpAddressName.Text = " "
        Dim sqlmatriz140 As String = "select tag from Materiales where descripcion='" & part.Text & "' order by tag "
        Dim trasn140 As New SqlDataAdapter(sqlmatriz140, conn)
        Dim dtrans140 As New DataSet
        trasn140.Fill(dtrans140, "Materiales")


        With txtNewIpAddressName
            .DataSource = dtrans140.Tables.Item("Materiales")
            .DisplayMember = "tag"
            .ValueMember = "tag"
            '.Text = " "
        End With


i wondering how to do it the revers way
tsm
edo
ErnestoAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Vadim RappCommented:
1. What is the name of the first combobox, and what is the name of the second combobox?

2. In your code you fill control "txtNewIpAddressName" with the data from the database basing on the text of control "part". Try to explain what you want in the similar sentence.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ErnestoAuthor Commented:
tsm
i want to achive this


Private Sub part_TextChanged(sender As Object, e As System.EventArgs) Handles part.TextChanged
       
 txtNewIpAddressName.Text = " "
        Dim sqlmatriz140 As String = "select tag from Materiales where descripcion='" & part.Text & "' order by tag "
        Dim trasn140 As New SqlDataAdapter(sqlmatriz140, conn)
        Dim dtrans140 As New DataSet
        trasn140.Fill(dtrans140, "Materiales")


        With txtNewIpAddressName
            .DataSource = dtrans140.Tables.Item("Materiales")
            .DisplayMember = "tag"
            .ValueMember = "tag"
            '.Text = " "
        End With
end sub


*** i supposed to it work in the other combobox event i put the same but in the reverse way


 Private Sub txtNewIpAddressName_TextChanged(sender As Object, e As System.EventArgs) Handles txtNewIpAddressName.TextChanged
        'part.Text = " "
         Dim sqlmatriz116 As String = "select descripcion from Materiales where tag='" & txtNewIpAddressName.Text & "' order by descripcion "
         Dim trasn116 As New SqlDataAdapter(sqlmatriz116, conn)
         Dim dtrans116 As New DataSet
        trasn116.Fill(dtrans116, "Materiales")


         With part
        .DataSource = dtrans116.Tables.Item("Materiales")
        .DisplayMember = "descripcion"
        .ValueMember = "descripcion"
        ' .Text = " "
        End With
end sub
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.