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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Grid question

Status
Not open for further replies.

dymadarlin

Programmer
Jun 26, 2003
41
0
0
CA
Hi there,
I've got a grid which is used thisway:

Dim tmp As DataSet = MyDataSet
DataGrid1.SetDataBinding(tmp, "MyTableName")

How can I:

1) Change the captions of the columns to something rather than the name of the column in the Database

2) Change the width of the Columns


Thanks


 
You need to apply a tablestyle to your datagrid.
 
I could get the whole link in for some reason. Here's the rest of it


library/en-us/dnwinforms/html/wnf_custdatagrid.asp
 
Shake,
Here is how i edit my datagrid properties.
'Map the style to the dataset table. In this case I only use one table
' in my query.

Dim GridColumnStyle As GridColumnStylesCollection


myGridTableStyle.MappingName = "Trial"
dgPacking.TableStyles.Add(myGridTableStyle)
myGridTableStyle.GridColumnStyles(1).Width = 245
myGridTableStyle.GridColumnStyles(1).ReadOnly = True
myGridTableStyle.GridColumnStyles(0).HeaderText = "Place Header text here"
myGridTableStyle.GridColumnStyles(0).ReadOnly = True
myGridTableStyle.AllowSorting = False
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top