Maulikpra 0 Newbie Poster
Dim mm As New SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=Integrated Security=True;Connect Timeout=30;User Instance=True")
        mm.Open()
        Dim mm1 As New SqlDataAdapter("select * from Area_type order by Area_name", mm)
        Dim ds As New DataSet
        mmm1.Fill(ds)
        With ComboBox1
            .DataSource = ds.Tables(0)
            .DisplayMember = "Area_name"
            .ValueMember = "Area_name"
            .SelectedIndex = 0
        End With
        mm.Close()

        'hi i am student and  what do i now for bind other combobox1 with combobbox2 help of above code????'
        'below code fill textbox to combobox3 Selected item what i do plz give full code with detail thanx'

        Dim mm1 As New SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=;Integrated Security=True;Connect Timeout=30;User Instance=True")
        mm.Open()
        Dim mm2 As New SqlDataAdapter("select * from Add_Book order by Book_name", mm)
        Dim ds1 As New DataSet
        mm2.Fill(ds1)
        With ComboBox3
            .DataSource = ds1.Tables(0)
            .DisplayMember = "Book_name"
            .ValueMember = "Book_id"
            .SelectedIndex = 0
        End With

 Private Sub ComboBox3_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox3.SelectedIndexChanged
        Dim mm3 As New SqlClient.SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=;Integrated Security=True;Connect Timeout=30;User Instance=True")
        Dim da As New SqlDataAdapter
        Dim dq As New DataSet
        Dim dt As DataTable
        Try
            da = New SqlDataAdapter("select * from Add_Book where Book_price = " & ComboBox1.SelectedItem & "", mm3)
            da.Fill(dq, "Add_Book")
            dt = dq.Tables("Add_Book")
        Catch ex As Exception
            MessageBox.Show(ex.Message)
        End Try
        TextBox1.Text = dt.Rows.Item(0).Item(0)
    End Sub       
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.