David,
your problem, that is very common, is because the MS Chart
control has also a DataGrid component. For this reason, depending
on which component is first in the list, VB access one or
the other. To fix any ambiguities, I always (well, at least after
I had your same problem ;) define a component with its associated
library, in your case:
Private Sub SetWidths(dg1 As MSDataGridLib.DataGrid)
m.
-----Original Message-----
From: David Biggins [mailto:David_Biggins@U...]
Sent: Friday, November 16, 2001 4:31 AM
To: professional vb
Subject: [pro_vb] Re: datagrid control
> N.T.GOPALAKRISHNAN
STOP PRESS: SOLVED! But read on anyway.
Thanks, you have it right, but it doesn't (always) work. Just spent a
frustrating morning watching it randomly succeed and fail on various
almost identical test projects before I caught on.
Test case. Simple form with a datagrid on it... Simple code module.
FORM CODE:
Private Sub Form_Load()
SetWidths DataGrid1
DataGrid1.Columns(0).Width=200
End Sub
MODULE CODE:
Private Sub SetWidths(dg1 As DataGrid)
dg1.Columns(0).Width = 99
End Sub
Can be made to work, or fail, depending SOLELY on whether or not the MS
Chart control is also in the selected components, and whether it got there
before or after the DataGrid (whether it is above or below it in the
Toolbox).
Simple solution is Project/Components uncheck chart control, Apply, check
chart control, Apply.
It can also be fixed by directly editing the VBP file to move the grid
control object reference to before the chart control object reference.
Thanks for trying it out for me, anyway.