473,378 Members | 1,471 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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 1749
"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
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
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
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
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.