0

i create 2 combobox in form, comboproduct & combomodel.
i using accessdatabase and using oledbconnection..database in debug folder...
i create 1 table, i name it"stock" & 2 column..
first column is product,second model..


i wont load data in product column into comboproduct and model to combomodel..like binding data..

anyone help me..

2
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by arezz09
1

arezz09, you already mark this thread as solved.
Would you like to share with us how you solve it ? So, when another member read your thread they will get the answer too.

Thanks.

Edited by Jx_Man: n/a

Votes + Comments
:)
0

use this if help...

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim conn As New OleDbConnection("provider=microsoft.jet.OleDb.4.0;Data Source=" & Application.StartupPath & "\stock.mdb")

        Dim cmd As OleDbCommand = New OleDbCommand("SELECT product,model FROM stock", conn)

        conn.Open()

        Dim sdr As OleDbDataReader = cmd.ExecuteReader

        While sdr.Read()

            comboproduct.Items.Add(sdr.Item("product").ToString)
            combomodel.Items.Add(sdr.Item("model").ToString)

        End While

        conn.Close()

        conn = Nothing

    End Sub
End Class

this should work..

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.