Results 1 to 5 of 5

Thread: Noobish question

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2008
    Posts
    4

    Noobish question

    How should i make a String called 'packets' send to Text2_Change.. And let it say "Found!"

    Code:
    Private Sub Text2_Change()
    if packets = "word" then
    msgbox "Found"
    end if
    end Sub
    And yes, i'm doing other stuff with the sub.. this is just an example..
    IF the option Change isn't possible.. how should i send the "packets" to the Sub..

    Thanks in advance..

  2. #2
    Frenzied Member PilgrimPete's Avatar
    Join Date
    Feb 2002
    Posts
    1,313

    Re: Noobish question

    You can't add extra parameters to the event handler; but, does something like this work for you?
    Code:
    Private Sub Text2_Change()
      call AnotherSub(Text2.Text)
    End Sub
    
    Private Sub AnotherSub(byval packets as string)
      if packets = "word" then
        msgbox "Found"
      end if
    end Sub

  3. #3

    Thread Starter
    New Member
    Join Date
    Apr 2008
    Posts
    4

    Re: Noobish question

    Quote Originally Posted by PilgrimPete
    You can't add extra parameters to the event handler; but, does something like this work for you?
    Code:
    Private Sub Text2_Change()
      call AnotherSub(Text2.Text)
    End Sub
    
    Private Sub AnotherSub(byval packets as string)
      if packets = "word" then
        msgbox "Found"
      end if
    end Sub
    I could use it.. But the "Anothersub" is on another form :d

  4. #4
    Lively Member
    Join Date
    Mar 2008
    Posts
    92

    Re: Noobish question

    if "Anothersub" is on another form, then surely you can use
    vb Code:
    1. Form2.Anothersub

  5. #5
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Noobish question

    You can do what calumrulez suggests, but only if the sub on the other form is declared as Public.

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