Solved

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

Posted on 2006-06-20
10
290 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 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

[Webinar] Learn How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

Question has a verified solution.

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

In this post we will learn different types of Android Layout and some basics of an Android App.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Simple Linear Regression
Progress

719 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