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)
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)
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
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
ASKER
Hi.
As far as i know, there is no "operator overloading" in vb6
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
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
ASKER
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
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
ASKER
I think it can be done since you can do so with vb controls like TextBox or Checkbox.
ASKER
Someone?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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.
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.
ASKER