Wednesday, August 18, 2010

Visual Basic 2005 Grid Control?

I want to use a grid or table control for displaying some program output in a grid style. This is not data from a database. How do I use the DataGrid without binding to a datasource, or what else can I use?Visual Basic 2005 Grid Control?
The DataGrid can DataBind to classes as well as database sources, you do all this in a similar way to how you would bind to a DataTable. MSDN has plenty of examples so I don't see a need to provide one here, but I often use the DataGrid without using data bases for grid / matrix based object editing.Visual Basic 2005 Grid Control?
If the information that you plan to display is lengthy, you are better off putting them in an xml file and use it as the datasource.





Otherwise, insert each row to the grid control programmatically. Code would look like this:





Dim nr as DataRow = Table.NewRow()


'Add stuff to row


Table.rows.add( nr )

No comments:

Post a Comment