Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2006-06-20
10
Medium Priority
?
305 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
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 86

Accepted Solution

by:
Mike Tomlinson earned 1760 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Simple Linear Regression
Starting up a Project

604 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