473,395 Members | 1,978 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,395 software developers and data experts.

Wake up control

Hi

I have solution with two projects, one of them is a user control
I created public shared sub in the user control which mean to wake up the
control and start doing somthing, but when i try to call it from the main
project i get error message
"Cannot refer to an instance member of a class from within a shared method
or shared member initializer without an explicit instance of the class."
What can i do?

Thanks

Aug 20 '07 #1
2 1486
On Aug 20, 10:52 am, "nondos" <non...@hotmail.comwrote:
Hi

I have solution with two projects, one of them is a user control
I created public shared sub in the user control which mean to wake up the
control and start doing somthing, but when i try to call it from the main
project i get error message
"Cannot refer to an instance member of a class from within a shared method
or shared member initializer without an explicit instance of the class."
What can i do?

Thanks
If you have to "wake up" each instance of the user control you need to
keep a reference to each instance in a shared variable (I would use a
dictionary or hashtable myself). You can add an instance to the list
of in the UserControl's constructor. To remove the instance reference,
I would have the UserControl implement IDisposible and remove itself
from the list in it's Dispose method (be sure to call dispose manually
- don't wait for the GC to do it for you). Then in your shared "wake
up" method you can loop through the list of instances and wake them
up.

Thanks,

Seth Rowe

Aug 20 '07 #2
Thanks

"rowe_newsgroups" <ro********@yahoo.comwrote in message
news:11**********************@22g2000hsm.googlegro ups.com...
On Aug 20, 10:52 am, "nondos" <non...@hotmail.comwrote:
>Hi

I have solution with two projects, one of them is a user control
I created public shared sub in the user control which mean to wake up the
control and start doing somthing, but when i try to call it from the main
project i get error message
"Cannot refer to an instance member of a class from within a shared
method
or shared member initializer without an explicit instance of the class."
What can i do?

Thanks

If you have to "wake up" each instance of the user control you need to
keep a reference to each instance in a shared variable (I would use a
dictionary or hashtable myself). You can add an instance to the list
of in the UserControl's constructor. To remove the instance reference,
I would have the UserControl implement IDisposible and remove itself
from the list in it's Dispose method (be sure to call dispose manually
- don't wait for the GC to do it for you). Then in your shared "wake
up" method you can loop through the list of instances and wake them
up.

Thanks,

Seth Rowe
Aug 21 '07 #3

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

Similar topics

3
by: The New Celibacy | last post by:
I go to bed at night, leaving XP running, and my Internet connection is dropped when I wake up. I go to bed at night, leaving Suse Linux running. I wake up in the morning, and it's still...
17
by: Benny Raymond | last post by:
I have a thread that sleeps for 5 minutes once it's finished running a method and then it repeats itself if it's supposed to (bool = true). Prior to 2.0 I was able to resume the thread after...
1
by: Moosdau | last post by:
Hi everyone: I have only found system.windows.forms.application.setsuspendstate method could make system into standby or hibernate state, but I don't know how to reboot the system. And I want...
1
by: Oscar | last post by:
Hi, Is there a way to to "wake" a win xp machine from screen power save using c#? I got a computer that turns off the screen after a while and i'm programming an app that reads smart cards and...
1
by: Johannes Kiehl | last post by:
guys, I need one more hint on this. I feel I am not tackling this in a php'ish way. I've been asking before, in this NG, how to monitor a (semaphore-like) file for timestamp changes, other...
3
by: ercastro | last post by:
I am a new user of Visual Basic. I am currently using VB 2005. I am running a time-consuming task on the built-in BackgroundWorker() control of VB. I am using nested loops and sometimes I need...
0
by: =?Utf-8?B?QnJhbmR5?= | last post by:
When I select standby by computer goes to sleep. When I try to wake it up with the mouse or keyboard it will not work. The drives and monitor are functioning though. I can even open the DVD/CD...
4
by: prometka | last post by:
Hi, I'm new here and I need a small advice Do you know how to wake up computer from hibernation or sleeping mode(in windows) by programming under C#? Let me explain my problem. I created a...
3
by: =?Utf-8?B?R2lsYmVydCBUb3JkZXVy?= | last post by:
Context : Windows Server 2003, IIS 6, VB 2008 My asp.net application A stores data in an SQL 2000 database. My application B (on the same server but under a different userid - not ASPNET) reads...
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
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,...
0
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
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,...
0
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...
0
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,...

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.