Datagrid expand on load ****resolved******
I have a datagrdid on my form, on page load it calls a function to connect to a sql db and populate it as shown in the code below.
Code:
Dim myDataSet As New DataSet()
Dim connString As String = SQL_CONNECTION_STRING
Dim cnn As SqlConnection = New SqlConnection(connString)
Dim myCommand As SqlCommand = New SqlCommand("Select * FROM Orders", cnn)
myCommand.CommandType = CommandType.Text
cnn.Open()
Dim myDataAdapter As SqlDataAdapter = New SqlDataAdapter(myCommand)
Try
myDataAdapter.Fill(myDataSet, "Employees")
Catch
MsgBox("Error in connecting to database. Call Computer about to implode!!")
End Try
cnn.Close()
dgEmployees.DataSource = myDataSet
All works fine, problem is, i have to click on a node to open up the table to show all records. I want it to open with the datagrid completely expanded.
I do this in other apps but i bind all columns etc at design time, the table i am sending in changes dynamically, i just want to display all the data without having the user click on a plu sign to expand the table.
i have tried
Code:
dgEmployees.DataSource = myDataSet.DefaultViewManager
but to no avail
Any ideas?