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

Is there a way to set the Max Length of a Datagrid Column?

Status
Not open for further replies.

nerdalert1

Programmer
Nov 4, 2004
92
US
I dont have that option in the properties of my datagrid. Any help all? Thanks
 
Nerdalert,

You can set the width of the column.

DataGrid1.Columns(X).Width = 5000

X above is the column number. Its zero base reference. The first column is zero then the next is 1 etc..

Dan
 
Do you mean graphically of Text wise?

Are you talking about something like the TextBox MaxLength property?

Have Fun, Be Young... Code BASIC
-Josh

cubee101.gif


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
If you ARE talking about the Text method...

You set that when you setup the RecordSet...

Code:
Private Sub CreateRS()
    Set m_rs = New ADODB.Recordset
    With m_rs
        .fields.Append "Col1", adVarWChar, [b]5[/b], adFldIsNullable Or adFldUpdatable
        .fields.Append "Col2", adVarWChar, [b]10[/b], adFldUpdatable Or adFldUpdatable
        .Open
    End With
End Sub

Col1 will have a max length of 5
Col2 will have a max length of 10


Have Fun, Be Young... Code BASIC
-Josh

cubee101.gif


PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top