First thing to do is debug your code and make sure there are values to insert into the combo box after the selection statement has run e.g. check the reader isn't empty.
hericles
Veteran Poster
1,065 posts since Nov 2007
Reputation Points: 156
Solved Threads: 228
Skill Endorsements: 9
You are declaring a dataset, initialize it and then proceed to use it as a datasource without ever filling it with data.
It shouldn't populate your combobox as it holds no data.
adam_k
Veteran Poster
1,057 posts since Jun 2011
Reputation Points: 274
Solved Threads: 205
Skill Endorsements: 11
Read this post on how to retrieve data in a combobox: http://www.daniweb.com/software-development/vbnet/threads/446843/multicolumn-combobox-from-access-data#post1928418
Although it's about separating what the user sees from what the db or the program will read, you can go ahead and modify it to suit your needs.
Alternatively you can use a bindingsource:
Try
myConnection = New SqlConnection(connectionstring)
myConnection.Open()
sqlcmd = New SqlCommand(" SELECT [S_Name]FROM [VBP].[dbo].[Purchase_Order] Where [O_N0]='" & Val(TextBox3.Text) & "'", myConnection)
Dim bind as new bindingsource
bind = sqlcmd.ExecuteReader
ComboBox3.datasource = bind
Catch err As Exception
MsgBox(err.Message, MsgBoxStyle.Exclamation)
End Try
myConnection.Close()
adam_k
Veteran Poster
1,057 posts since Jun 2011
Reputation Points: 274
Solved Threads: 205
Skill Endorsements: 11
Question Answered as of 3 Months Ago by
adam_k,
hericles,
M.Waqas Aslam
and 1 other