Solved

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

Posted on 2006-06-20
10
276 Views
Last Modified: 2010-05-18
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)


 
0
Comment
Question by:allallall
  • 6
  • 3
10 Comments
 
LVL 1

Author Comment

by:allallall
ID: 16947052
It should be easy no?
0
 
LVL 3

Expert Comment

by:Dimkov
ID: 16948898
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
 
LVL 1

Author Comment

by:allallall
ID: 16951910
Hi.
As far as i know, there is no "operator overloading"  in vb6
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.

 
LVL 3

Expert Comment

by:Dimkov
ID: 16957477
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
 
LVL 1

Author Comment

by:allallall
ID: 16958963
I am writing in vb6 not in vs2005.
0
 
LVL 3

Expert Comment

by:Dimkov
ID: 16959159
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
 
LVL 1

Author Comment

by:allallall
ID: 16964815
I think it can be done since you can do so with vb controls like TextBox or Checkbox.
 
0
 
LVL 1

Author Comment

by:allallall
ID: 16975037
Someone?
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 440 total points
ID: 17039809
0
 
LVL 1

Author Comment

by:allallall
ID: 17045832
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

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

792 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question