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)


 
LVL 1
allallallAsked:
Who is Participating?
 
Mike TomlinsonConnect With a Mentor Middle School Assistant TeacherCommented:
0
 
allallallAuthor Commented:
It should be easy no?
0
 
DimkovCommented:
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
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
allallallAuthor Commented:
Hi.
As far as i know, there is no "operator overloading"  in vb6
0
 
DimkovCommented:
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
0
 
allallallAuthor Commented:
I am writing in vb6 not in vs2005.
0
 
DimkovCommented:
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
0
 
allallallAuthor Commented:
I think it can be done since you can do so with vb controls like TextBox or Checkbox.
 
0
 
allallallAuthor Commented:
Someone?
0
 
allallallAuthor Commented:
Idle_Mind  Thanks.
Write a comment here:
http://www.experts-exchange.com/Programming/Q_21908096.html
too, so i will be able to give you the points from that question too.

Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.