-
I have a form1 with a command button. The command button calls a module, but for some reason it's not working. The module is coded to load form2, and on it draw a line at run time.
Could someone please help me out? I keep getting an error saying:
'Method or data member not found', and Line1 is highlighted.
Thanks for any help!
'there is form1, form2 and module1
'Command button on form1
Private Sub Command1_Click()
Call line1
End Sub
'code for the module
Public Sub line1()
Form2.Show
Form2.Controls.Add "VB.line", "line1"
Form2.line1.X1 = 1560
Form2.line1.X2 = 1560
Form2.line1.Y1 = 1800
Form2.line1.Y2 = 4800
Form2.line1.Visible = True
End Sub
-
Change your module code to:
Code:
Public Sub Line1()
Form2.Show
Form2.Controls.Add "VB.Line", "Line1"
Form2!Line1.X1 = 1560
Form2!Line1.X2 = 1560
Form2!Line1.Y1 = 1800
Form2!Line1.Y2 = 4800
Form2!Line1.Visible = True
End Sub
(Use Form2!Line1 instead of Form2.Line1)
HTH
[Edited by QWERTY on 06-28-2000 at 02:58 PM]
-
Thanks,
Just out of interest, what is the '!' character for? It seems to have no purpose (they could use Form2.Line1) and confuse programmers.