Here is my code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
InitializeComponent()
Dim str As New StreamReader("C:\projects\servers.txt")
Dim server As String = str.ReadToEnd().ToString()
str.Close()
Dim thisconnection As New SqlConnection("server=" & server & ";integrated security=True;database=Deduping")
Dim thisAdapter As New SqlDataAdapter()
Dim cmdthisAdapter As New SqlCommand("SELECT ProjectNumber, ProjectName FROM Projects", thisconnection)
thisAdapter.SelectCommand = cmdthisAdapter
Dim thisdataset As New DataSet()
thisAdapter.Fill(thisdataset, "ProjectNumbers")
For Each therow As DataRow In thisdataset.Tables("ProjectNumbers").Rows
Dim proj As String = therow("ProjectNumber").ToString()
ComboBoxProject.Items.Add(therow("ProjectNumber"))
Next
thisconnection.Close()
End Sub

I've added the proj string in just to ensure that a valid string is present in therow("projectnumber").tostring() and it is. For some reason the combobox is not updating with the data.

Please help!

BTW, I've also tried comboboxproject.items.add(therow("projectnumber")).tostring() to no avail.

u cannot add the complete row to the combo box.
u will add the value of a column
so
combobox.items.add(datarow("Column name").tostring)

Be a part of the DaniWeb community

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