HELP :Setting Column width in a DBGrid ?

HELP :Setting Column width in a DBGrid ?

Post by Bill Danne » Sat, 29 Aug 1998 04:00:00



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

 
 
 

HELP :Setting Column width in a DBGrid ?

Post by P.R.Joh » Sun, 30 Aug 1998 04:00:00


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)


>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


 
 
 

1. DBGrid and Setting Column Widths at design time

How do you set the Column widths at design time?  I need to set two of my
five column widths to 50.  All the help say is that the column widths is
based on the coordinate of the container.  What does all this means and how
do I change the coordinates of the two columns to reflect a column width of
50?

                                           Sheila

2. DSN doesn't show up sometimes

3. fixed width - dynamically set column widths

4. sql select

5. Setting width of DBGrid at runtime

6. URGENT: Linux 6.0, PHP3, Oracle et ORA-03106

7. Column Widths in DBGrid

8. Multiple directory Manipulation

9. VB4 - DBGrid columns width.

10. changing column widths in DBGrids

11. DBGrid column widths

12. Delphi DBGrid Column widths

13. Column width in dbGrid