Groups | Blog | Home
all groups > vb.net controls > september 2004 >

vb.net controls : Overwhelmed by the DataGrid


Rob Richardson
9/6/2004 5:47:41 PM
Greetings!

I am trying to figure out how to work with the DataGrid control. I am able
to bind it to a SQL Server view by loading the view into a DataTable and
setting the grid's DataSource property to that DataTable. The grid shows
the contents of the view and sorts them very nicely. But what do I do after
that? I can't follow the help file's discussions about TableStyle and
ColumnStyle collections and objects at all. Suppose I want to only show
half of the columns in my view. How do I set what columns I want to show?
Suppose I want to format the data in some way. How do I do that? (That one
is from real life. A couple of the columns contain percentages. I want to
limit the data in those columns to two decimal places and add a percent
sign. I could do that in VB.Net simply with the Format() function.)

Can somebody point me to someplace where I can find a clear description of
how to perform simple tasks using the DataGrid control?

Thank you very much!

Rob Richardson

Ken Tucker [MVP]
9/6/2004 6:19:26 PM
Hi,

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchformattingwindowsformsdatagridvisualbasicprimer.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwinforms/html/wnf_custdatagrid.asp

Ken
------------------
[quoted text, click to view]
Greetings!

I am trying to figure out how to work with the DataGrid control. I am able
to bind it to a SQL Server view by loading the view into a DataTable and
setting the grid's DataSource property to that DataTable. The grid shows
the contents of the view and sorts them very nicely. But what do I do after
that? I can't follow the help file's discussions about TableStyle and
ColumnStyle collections and objects at all. Suppose I want to only show
half of the columns in my view. How do I set what columns I want to show?
Suppose I want to format the data in some way. How do I do that? (That one
is from real life. A couple of the columns contain percentages. I want to
limit the data in those columns to two decimal places and add a percent
sign. I could do that in VB.Net simply with the Format() function.)

Can somebody point me to someplace where I can find a clear description of
how to perform simple tasks using the DataGrid control?

Thank you very much!

Rob Richardson


Rob Richardson
9/6/2004 6:29:21 PM
Ken,

Thanks very much! Those look like exactly what I need to get over the hump.

Rob

AddThis Social Bookmark Button