
HELP :Setting Column width in a DBGrid ?
DBGrid1.Columns(0).Width=nnn
DBGrid1.Refresh.
The same for Columns(1) and (2). You might find 750 or thereabouts will hold
5 chars as a setting, depending on your Scale. You'll get truncated column
headings if you have them turned on, though you can alias these.
Put in after the Data1 settings.
PS - if your CUSTNO field really is Text, you'll need to put double quotes
around the variable in the query; I use "... WHERE CUSTOMER.CUSTNO = " &
Chr(34) & txtFindCustno & Chr(34)
Quote:
>I am trying to set the column widths in DBGrid1
>The first 3 field columns in my DBGrid1 need to be only 4 or 5 chars.
>wide.
>I would like to set them with code, so they are the correct width when
>I run the program, rather than adjust them after I start the program.
>Any help as to how/where this is to be done would be greatly
>appreciated.
>TKS
>Bill Dannels (NewBee)
>Private Sub cmdFindCustNo_Click()
>Sqlcode2 = "SELECT ORDERS.CUSTNO, ORDERS.DATE, ORDERS.PLANTORNU,
>CUSTOMER.NAME," _
>& " ORDERS.QUANITY, ORDERS.WSize, ORDERS.LSize, ORDERS.Each,
>ORDERS.PricePerM" _
>& " FROM CUSTOMER INNER JOIN ORDERS ON CUSTOMER.CUSTNO =
>ORDERS.CUSTNO" _
>& " WHERE CUSTOMER.CUSTNO =" & txtFindCustNo
>Data1.RecordSource = Sqlcode2
>Data1.Refresh
>End Sub