473,672 Members | 2,652 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 1780
"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 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...
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 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...
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 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...
2
1316
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 two different threads for the GUI and for the loop that sends commands to the robot, but I am having trouble communicating between the threads. Right now I am trying to get the GUI thread to raise an event when the user
0
8943
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8844
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8638
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7466
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6254
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4239
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4438
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2836
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 we have to send another system
2
1834
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.