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!