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

Visual Basic Datagrid 1

Status
Not open for further replies.

rspangle

MIS
Jan 8, 2002
5
US
I have created a datagrid in Visual Basic 6. Does anyone know how to change the width of the individual fields in the datagrid without manually changing them at the top of the structure
 
Yeah - I did this one for work about a year back...

I think the best way for me to explain this is to simply try and write you a quick Subroutine... Try slapping this in a module...

Code:
public sub ChangeColWidth(TheGrid as DataGrid, ColNo as Integer, NewWidth as integer)

'Declare a Column object
Dim TheCol as Column

'Now set it to be the column on the grid we are looking for...

Set TheCol = TheGrid.columns(ColNo - 1)

'Now resize the column
TheCol.Width = NewWidth

'And finally deallocate the reference.
set TheCol = Nothing

end sub

That's just a quick stab at the function - you might have to debug it, but it should be close...

Martin
 
I'm also looking for a way to do the same thing with a defined recordset. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top