473,513 Members | 2,421 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Communicating between a User Control and a Class

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
Nov 20 '05 #1
2 1756
"Paul Bromley" <fl*******@dsl.pipex.com> 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

Nov 20 '05 #2
"Paul Bromley" <fl*******@dsl.pipex.com> 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

Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
293
by: Paul Bromley | last post by:
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...
0
212
by: Paul Bromley | last post by:
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...
0
271
by: Paul Bromley | last post by:
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...
2
1310
by: aaronj1335 | last post by:
I am trying to write an application that controls a robot via a serial port. I made a robot class that includes the serial port over which I send commands, and I would like to be able to have...
0
7166
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7543
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7106
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5689
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5094
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4749
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3236
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1601
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
459
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.