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
Re: Strange problem with richtextbox
Re: Strange problem with richtextbox
textbox, i believe is a reserved name, since you can go dim x as textbox
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:
Option Explicit
Private Sub Test(TextBx As RichTextBox)
MsgBox "Hello"
End Sub
Private Sub Command1_Click()
Test RichTextBox1
End Sub
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.
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()