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

defining coloumn size in a datagrid 1

Status
Not open for further replies.

DeepBlerg

Technical User
Jan 13, 2001
224
0
0
AU
to define colunmn size for ALL coloumns in a datagrid i use DataGrid1.DefColWidth = 1000

but what if I have a datagrid with say 6 coloumns and i want to define different coloumn sizes for each coloumn?

thanks....
 

Use this code:

Dim mColumnWidth As Integer
For i = 0 To (DataGrid1.Columns.Count - 1)
Select Case i
Case 0, 2, 4
mColumnWidth = 2000
Case Else
mColumnWidth = 500
End Select
DataGrid1.Columns(i).Width = mColumnWidth
Next


Hope this will help u? :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top