Passing Control Name to UserControl [Resolved]
Here is a problem I am having.
I have a function within a UserControl which takes one parameter (Control)
e.g
VB Code:
public function myFunc(ctrl as Control)
end functioin
Now when I place this UserControl in a form and call this function and pass
call myFunc(txtUsername), it gives me Type Mismatch error, now as we know in VB6 the Text is the default property so it is passing the Text instead of the Control itself. Thing is that if I place the same function in the form itself it works fine.
Any Idea how I can pass it as a Control rather then Text?
I know I can probably add a Module and place the code there which might reolve the problem, but I want to have this code in a UserControl.
Thanks in advance.
Re: Passing Control Name to UserControl
Never mind I resolved it, I was calling it like myFunc(txtUsername) instead of myFunc txtUsername or Call myFunc(txtUsername). That was the problem.
Re: Passing Control Name to UserControl
Cool. I was looking for a resolution.
Re: Passing Control Name to UserControl
Quote:
Originally Posted by dglienna
Cool. I was looking for a resolution.
Thanks for trying. Its wired, the compiler should have flagged it. If I have those bracket it passes the parameter as string otherwise passes it as Control.
Another reason why I have moved on to C# :wave: