Link to home
Start Free TrialLog in
Avatar of allallall
allallall

asked on

UserControll-How to implement ival=MyUserControl (instead of ival=MyUserControl.value)

UserControll-How to implement ival=MyUserControl (instead of  ival=MyUserControl.value)

I have a user control.
I want to be able to do:
dim iVal
iVal =MyUserControl

Like i do in checkbox control.
iVal=ckbSomeCheckbox
and get the ckbbox value.

or in TextBox control
(sText=txtSomeTextBox)


 
Avatar of allallall
allallall

ASKER

It should be easy no?
allallall,
I program in C++, and what I would do in your case is overwrite the = operator.

in c++ it will be
int operator=(const usercontrol MyUserControl)
{
   return MyUserControl.value;
}
Hope it helps, Dimkov
Hi.
As far as i know, there is no "operator overloading"  in vb6
allallall

Operator overloading is a new in the VB world, but with VS2005 you can use it:

it should be like:

 Public Shared Operator =(ByVal MyUserControl As usercontrol ) As int
        Return MyUserControl.value

Dimkov
I am writing in vb6 not in vs2005.
in this case, you cant acheave this thing.
The reason is, the compiler doesnt know if you want the control to return integer, or string or boolean....
Sorry I couldn't be from more help
I think it can be done since you can do so with vb controls like TextBox or Checkbox.
 
Someone?
ASKER CERTIFIED SOLUTION
Avatar of Mike Tomlinson
Mike Tomlinson
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Idle_Mind  Thanks.
Write a comment here:
https://www.experts-exchange.com/questions/21908096/UserControl-How-to-implement-ival-MyUserControl-instead-of-ival-MyUserControl-value.html
too, so i will be able to give you the points from that question too.

Thanks.