Ok i understand the fact that once events are raised they are executed
on another thread and have no access to member functions or variables
because they are static functions.
But i am having trouble how i can Invoke these methods from the static
method.
Can anyone help me out here? :)
TIA! 2 1895
Ahmed,
This isn't true. Events are executed on the thread that they are raised
on. When the events are fired on another thread, it is because they are
raised on that thread.
Also, event handlers can be static methods, or instance methods. You
can attach an event handler to an instance method, and then access all the
members of that instance in the event handler (since it is just another
member).
So instead of attaching to a static method, why not attach to an
instance method which has access to the members you need?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Ahmed" <ah*****@gmail. comwrote in message
news:11******** **************@ x35g2000prf.goo glegroups.com.. .
Ok i understand the fact that once events are raised they are executed
on another thread and have no access to member functions or variables
because they are static functions.
But i am having trouble how i can Invoke these methods from the static
method.
Can anyone help me out here? :)
TIA!
wow you are right! Ok my book on C# is really misleading and all its
templates are based on static functions which led me to believe it HAD
to be a static function.
Thanks for the help! :)
Ahmed
On Jun 5, 5:21 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guar d.caspershouse. comwrote:
Ahmed,
This isn't true. Events are executed on the thread that they are raised
on. When the events are fired on another thread, it is because they are
raised on that thread.
Also, event handlers can be static methods, or instance methods. You
can attach an event handler to an instance method, and then access all the
members of that instance in the event handler (since it is just another
member).
So instead of attaching to a static method, why not attach to an
instance method which has access to the members you need?
--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard .caspershouse.c om
"Ahmed" <ahme...@gmail. comwrote in message
news:11******** **************@ x35g2000prf.goo glegroups.com.. .
Ok i understand the fact that once events are raised they are executed
on another thread and have no access to member functions or variables
because they are static functions.
But i am having trouble how i can Invoke these methods from the static
method.
Can anyone help me out here? :)
TIA!
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: quo |
last post by:
two questions:
1) Does this program demonstrate the basic difference between public
and private access?
It appears correct to say that instances of a class cannot directly
call a private method, but a public method can be called by the
instance to invoke the private method.
2) So is it true that only public methods of a class can invoke a
private method of that same class?
|
by: Roger Leigh |
last post by:
The C++ book I have to hand (Liberty and Horvath, Teach yourself C++
for Linux in 21 Days--I know there are better) states that "static
member functions cannot access any non-static member variables".
However, this doesn't seem entirely correct. It also doesn't mention
whether static member functions can access protected and private
member data and methods (and I couldn't spot this in the FAQ).
I have a class row<Row> which derives from...
|
by: Joakim Braun |
last post by:
Why doesn't the below code work?
I'm trying to create a global object and set an event handler to one of its
methods. The function is called, but the object's mTest property is
undefined.
(What I'm trying to do is make a general-purpose solution for the situation
where you have a list box with several associated form elements. When the
element values are changed, you want to update the value of the selected
list option, and when the...
|
by: Peter Frost |
last post by:
Please help
I don't know if this is possible but what I would really like to do is
to use On Error Goto to capture the code that is being executed when
an error occurs.
Any help would be much appreciated.
Thanks in advance
|
by: Colin Anderson |
last post by:
I discovered, with great excitement, this article
http://www.davison.uk.net/vb2notes.asp when researching methods for
emailing from Access via Notes. Unfortunatly, when I run this I get a
Run-time error. When I run it on an XP machine it crashes, but on an
NT box it just generates an unknown error, handled by the error
handler. I have debugged and stepped through the code and have
narrowed the issue to the point at which the...
| |
by: Yannick Turgeon |
last post by:
Hello,
We are in the process of examining our current main application. We have to
do some major changes and, in the process, are questionning/validating the
use of MS Access as front-end. The application is relatively big: around 200
tables, 200 forms and sub-forms, 150 queries and 150 repports, 5GB of data
(SQL Server 2000), 40 users.
I'm wondering what are the disadvantages of using Access as front-end? Other
that it's not...
|
by: David Sullivan |
last post by:
Hi
I have a problem with a database where certain users are closing access (by
clicking on the X in top right-hand corner) instead of using a command
button before they fill in all relevant fields.
Q. Is there a way of not allowing them to exist access using the this way
and use the command button?
Thanks in Advance
|
by: Jon Hyland |
last post by:
This might be a dumb question, but what is the best way for one
instance of a user control to access properties of an instance of
another user control?
For example, let's say I have an instance of UserControlA (ucA1) and
an instance of UserControlB (ucB1) on a particular ASP.NET page.
UserControlA has a string property called StringA that gets generated
from a DB call in it's Page_Load event. I want UserControlB to be
able to access...
|
by: Michael |
last post by:
Hi,
I'm having difficulty finding any previous discussion on this -- I
keep finding people either having problems calling os.exec(lepev), or
with using python's exec statement. Neither of which I mean here.
Just for a moment, let's just take one definition for one of the
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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...
|
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
| |
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...
| |