We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,645 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

load data to combobox

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
7 Hours
Discussion Span
2 Years Ago
Last Updated
3
Views
Question
Answered
arezz09
Junior Poster
101 posts since Feb 2011
Reputation Points: 8
Solved Threads: 2
Skill Endorsements: 0
Question Self-Answered as of 2 Years Ago

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.

Jx_Man
Senior Poster
3,521 posts since Nov 2007
Reputation Points: 1,468
Solved Threads: 514
Skill Endorsements: 64

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..

arezz09
Junior Poster
101 posts since Feb 2011
Reputation Points: 8
Solved Threads: 2
Skill Endorsements: 0

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0921 seconds using 2.65MB