Results 1 to 3 of 3

Thread: VB6...module...

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 1999
    Location
    Glasgow,Scotland
    Posts
    281

    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

  2. #2
    Fanatic Member
    Join Date
    Oct 1999
    Location
    MA, USA
    Posts
    523
    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]

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 1999
    Location
    Glasgow,Scotland
    Posts
    281

    Thumbs up


    Thanks,

    Just out of interest, what is the '!' character for? It seems to have no purpose (they could use Form2.Line1) and confuse programmers.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width