PC Review


Reply
Thread Tools Rate Thread

Communicating between a User Control and a Class

 
 
Paul Bromley
Guest
Posts: n/a
 
      11th Apr 2004
Hi,

Can someone point me in the right direcion here. I have been a hobbyist
programmer for some time with VB6 and am moving to Vb.Net. I am afraid that
in the past I did not uderstand too well how to uses Classes, but realise
that I need to do this to use Vb.Net. Hence I have 'bitten the bullet and am
trying hard. I seem to be making soem headawy, adn I can see the advantages
re encapsulation and code re-use.

Now to my question - I have created a user control and need to communicate
with a Class that I have written. If I placed the Calss inside the control
then I would have no problem in accessing a Property or a method in the
Class. However I do need that Class to be available from my program itself,
so I should not be placing this in the control. I have done a lot of
searching and eading about this to try to figure it out, and am coming to
the conclusion that I should be learning about Delegates to achive this.
So - please help to point me in the right direction - should I be looking at
Delegates or should I be looking at Events? I started looking at Events, and
Delegates to me look a simpler concept for me to grasp.

Can anyone give me any very SIMPLE examples of how I can invoke a method or
set a property from another Class? SOrry if I have this all wrong - I seem
to be on a very steep learning curve at the moment, and although some things
are 'clicking' into place, I am not fully there yet!!

Many thanks

Paul Bromley


 
Reply With Quote
 
 
 
 
Armin Zingler
Guest
Posts: n/a
 
      11th Apr 2004
"Paul Bromley" <(E-Mail Removed)> schrieb
> Hi,
>
> Can someone point me in the right direcion here. I have been a
> hobbyist programmer for some time with VB6 and am moving to Vb.Net. I
> am afraid that in the past I did not uderstand too well how to uses
> Classes, but realise that I need to do this to use Vb.Net. Hence I
> have 'bitten the bullet and am trying hard. I seem to be making soem
> headawy, adn I can see the advantages re encapsulation and code
> re-use.
>
> Now to my question - I have created a user control and need to
> communicate with a Class that I have written. If I placed the Calss
> inside the control then I would have no problem in accessing a
> Property or a method in the Class. However I do need that Class to be
> available from my program itself, so I should not be placing this in
> the control. I have done a lot of searching and eading about this to
> try to figure it out, and am coming to the conclusion that I should
> be learning about Delegates to achive this. So - please help to point
> me in the right direction - should I be looking at Delegates or
> should I be looking at Events? I started looking at Events, and
> Delegates to me look a simpler concept for me to grasp.
>
> Can anyone give me any very SIMPLE examples of how I can invoke a
> method or set a property from another Class? SOrry if I have this all
> wrong - I seem to be on a very steep learning curve at the moment,
> and although some things are 'clicking' into place, I am not fully
> there yet!!
>
> Many thanks


If you want to access an object, you need a reference. If it's not
available, you have to make it available. Where when and how depends on the
circumstances. Usually, the reference is passed as an argument of a
procedure. Could you please explain what's the purpose of the class and the
Usercontrol and what they do? I'd need this information to find the best
solution. I guess, you won't need Delegates.


--
Armin

How to quote and why:
http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Load User control by class name Lou Microsoft C# .NET 2 10th Feb 2009 05:58 AM
How to create an instance of user control in a class(simple) file notin Page class file? chandan Microsoft ASP .NET 2 3rd Dec 2007 06:01 AM
composite & user control that contains a class =?Utf-8?B?RGF2ZQ==?= Microsoft VC .NET 0 19th Apr 2007 12:04 PM
This must be a bug in C# when using user control DLL and class library DLL Tony Johansson Microsoft Dot NET Framework 1 2nd Apr 2006 08:19 PM
This must be a bug in C# when using user control DLL and class library DLL Tony Johansson Microsoft Dot NET 0 2nd Apr 2006 04:10 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:48 PM.