Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DataGrid not populating on open form

Status
Not open for further replies.

Ahssan

Programmer
Nov 4, 2003
27
KW
Hi guys

I have a form which has 1 datagrid in it and datagrid is link to a data connection. the problem is when i open the form the datagrid populates but the rows are collapsed. i have to click on newdata set word in the grid then on table word in the grid to view the data. any body tell me how i can eliminate these clicks? and what property should i set in order to achieve this.

thanks
 
Try the DataGrid1.expand method

DotNetDoc
M.C.S.D.
[2thumbsup]
---------------------------------------

Tell me and I forget. Show me and I remember. Involve me and I understand.
- Anonymous Chinese Proverb

-----------------------------------

If you can't explain it simply, you don't understand it well enough.
- A. Einstein
 
Also, if you wanted more control over the display you could do something like this.

Dim objDataGridStyle As New DataGridTableStyle()
Dim objTextCol As New DataGridTextBoxColumn()

DataGrid1.TableStyles.Clear()

'The following code formats the datagrids column header and width
'Set the MappingName for the DataGridTableStyle
objDataGridStyle.MappingName = "ReturnData"

'Set references for columns
objTextCol.MappingName = "tsstamp"
objTextCol.Width = 110
objTextCol.HeaderText = "Event Date"
objDataGridStyle.GridColumnStyles.Add(objTextCol)

objTextCol = New DataGridTextBoxColumn()
objTextCol.MappingName = "usrid"
objTextCol.Width = 45
objTextCol.HeaderText = "User ID"
objDataGridStyle.GridColumnStyles.Add(objTextCol)

'Add the DataGridTableStyle to the DataGrid
DataGrid1.TableStyles.Add(objDataGridStyle)


This can also be acheived through the datagrids properties window.
 
i have tried the expand method it does expand but no the rows it expands the datatable on which i have to click on table link and then all the rows expand.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top