Results 1 to 6 of 6

Thread: Strange problem with richtextbox

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2002
    Posts
    14

    Strange problem with richtextbox

    Hi, I am sure I had this working before, and after I implemented another feature of it now it is not working, and removing the feature that I recently added its still not working.

    If I had a RichTextBox, and I implement this in KeyUp function

    Call test(RichTextBox1)


    And put this in the form

    Private Sub test(textbx As TextBox)
    MsgBox 'i am here'
    End Sub


    It does not even enter the test sub (). Why?

    Private Sub test(textbx As control)
    this works. not sure why textbox wouldn't though
    Last edited by Hack; Oct 22nd, 2007 at 05:25 AM.
    -scmay-

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

    Re: Strange problem with richtextbox

    How did you call it?

  3. #3
    Addicted Member
    Join Date
    Jul 2006
    Location
    Adelaide, Australia
    Posts
    204

    Re: Strange problem with richtextbox

    textbox, i believe is a reserved name, since you can go dim x as textbox

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

    Re: Strange problem with richtextbox

    It is, but he didn't use TextBox as a variable name, but rather as a type.

    Incidentially, if you are using a richtextbox, then your type should be that, not TextBox. This worked just fine for me.
    vb Code:
    1. Option Explicit
    2.  
    3. Private Sub Test(TextBx As RichTextBox)
    4. MsgBox "Hello"
    5. End Sub
    6.  
    7. Private Sub Command1_Click()
    8. Test RichTextBox1
    9. End Sub

  5. #5
    Addicted Member
    Join Date
    Jul 2006
    Location
    Adelaide, Australia
    Posts
    204

    Re: Strange problem with richtextbox

    Oh, i thought he was saying he was trying to use textbox as the variable name:
    Code:
    Private Sub test(textbox As TextBox)
    MsgBox 'i am here'
    End Sub
    But i can see why it didnt work, now that i see what he was doing.

  6. #6

    Thread Starter
    New Member
    Join Date
    Mar 2002
    Posts
    14

    Re: Strange problem with richtextbox

    Quote Originally Posted by Hack
    How did you call it?

    Call test(RichTextBox1)

    Declaring it as RichTextBox will work too. I just realized that out of the 3 textboxes 1 that wasn't working was because I made it a control array, and that somehow doesn't make it go to the test()
    -scmay-

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