Solved

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

Posted on 2006-06-20
10
270 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

This is an explanation of a simple data model to help parse a JSON feed
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
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…

776 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