473,398 Members | 2,525 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,398 software developers and data experts.

Referencing "Application.*"

Certain "Imports" of classes change the frame of reference within a class
such that making calls to functions such as "Application.DoEvents()" and so
on becomes ambiguous and gives a "Reference to a non-shared member requires
an object reference" error on Build.

This should be easy to figure out, but I am having no luck: How do I
reference these "generic" events if I have to do an Import like that?

I have tried <application name>.DoEvents() and <class name>.DoEvents() but
nothing seems to work.

Thanks.
Nov 20 '05 #1
5 1509
Application.DoEvents()

See below . . . Regards - OHM#
Private stopMe as Boolean = False
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

stopMe = True

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click

Dim i As Int32

While stopMe = False

Application.DoEvents()

Debug.WriteLine(i)

i += 1

End While

End Sub
Scupper wrote:
Certain "Imports" of classes change the frame of reference within a
class such that making calls to functions such as
"Application.DoEvents()" and so on becomes ambiguous and gives a
"Reference to a non-shared member requires an object reference" error
on Build.

This should be easy to figure out, but I am having no luck: How do I
reference these "generic" events if I have to do an Import like that?

I have tried <application name>.DoEvents() and <class
name>.DoEvents() but nothing seems to work.

Thanks.


Regards - OHM# On**********@BTInternet.com
Nov 20 '05 #2
Thanks, but I'm not sure how this addresses my question ...

I understand how to use DoEvents. The problem is that when I add an
Import to the class, such as "Word.ApplicationClass" or something, that
has an "Application" type, I can no longer call "Application.*"
functions as you show below, as I get a "Reference to a non-shared
member requires an object reference" error when I build the application.
I'm wondering how to call them when I cannot use that syntax.
"One Handed Man [ OHM# ]" <On**********@BTInternet.com> wrote in
news:OX**************@tk2msftngp13.phx.gbl:
Application.DoEvents()

See below . . . Regards - OHM#
Private stopMe as Boolean = False
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

stopMe = True

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click

Dim i As Int32

While stopMe = False

Application.DoEvents()

Debug.WriteLine(i)

i += 1

End While

End Sub

Nov 20 '05 #3
Sorry, you have to instantiate a new application object before you can
reference it.

Private WordApp As New Word.ApplicationClass

OHM#
Scupper wrote:
Thanks, but I'm not sure how this addresses my question ...

I understand how to use DoEvents. The problem is that when I add an
Import to the class, such as "Word.ApplicationClass" or something,
that has an "Application" type, I can no longer call "Application.*"
functions as you show below, as I get a "Reference to a non-shared
member requires an object reference" error when I build the
application. I'm wondering how to call them when I cannot use that
syntax.
"One Handed Man [ OHM# ]" <On**********@BTInternet.com> wrote in
news:OX**************@tk2msftngp13.phx.gbl:
Application.DoEvents()

See below . . . Regards - OHM#
Private stopMe as Boolean = False
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

stopMe = True

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click

Dim i As Int32

While stopMe = False

Application.DoEvents()

Debug.WriteLine(i)

i += 1

End While

End Sub


Regards - OHM# On**********@BTInternet.com
Nov 20 '05 #4
But how do I refer to the Application object for my own app (rather than
the Application object when there are multiple references that have
Application objects?

The prog doesn't know whether I mean "Word.Application.DoEvents()" or
something else specific to my app. How do I tell it "<my
application>.Application.DoEvents()"? Or some "generic" DoEvents, referring
to the whole process?

"One Handed Man [ OHM# ]" <On**********@BTInternet.com> wrote in
news:OO**************@TK2MSFTNGP10.phx.gbl:
Sorry, you have to instantiate a new application object before you can
reference it.

Private WordApp As New Word.ApplicationClass

Nov 20 '05 #5
"Scupper" <scupperAThotmailDOTcom> schrieb
But how do I refer to the Application object for my own app (rather
than the Application object when there are multiple references that
have Application objects?

The prog doesn't know whether I mean "Word.Application.DoEvents()" or
something else specific to my app. How do I tell it "<my
application>.Application.DoEvents()"? Or some "generic" DoEvents,
referring to the whole process?


System.Windows.Forms.Application.DoEvents

see also:

http://msdn.microsoft.com/library/en...gConflicts.asp

and: (sub topics 4.7.1 and 4.7.2)

http://msdn.microsoft.com/library/en...fVBSpec4_7.asp
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #6

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

Similar topics

1
by: Benny Ng | last post by:
Hi,All, Export Method: ------------------------------------------------------------------------- strFileNameExport = "Results" Response.Clear() Response.Buffer = True...
5
by: TJS | last post by:
trying to display pdf file in browser fails on this line: Response.ContentType = "application/pdf" getting an error about no declaration found for "response" what declaration is needed ???
2
by: news.microsoft.com | last post by:
hi, I am new in ASP.NET i make a page using Visual Studio.net compile and successfully run on local system but when i upload it on my internet live server it always gives me the same error if...
2
by: CVerma | last post by:
I'm using an html input control (System.web.UI.HTMLControls.HTMLInputFile) to upload files such as msword, excel, jpg, and pdf. I have the encType property set in the form:...
3
by: Arjen | last post by:
Hello, Are the ASP.NET 2.0 "Building Block's" the same this as the Enterprise Library Application Blocks? Thanks! Arjen
13
by: Bob Day | last post by:
Using vs2003, vb.net I start a thread, giving it a name before start. Code snippet: 'give each thread a unique name (for later identification) Trunk_Thread.Name = "Trunk_0_Thread" ' allow...
7
by: Russ Green | last post by:
I am currently developing an application in VB.NET that uses the Microstation's object model via COM Interop. I have a problem regarding multiple instances of the Microstation application...
6
by: Steve4D | last post by:
With an ASP.NET application, I try to run an external program (like EXE, BAT) with a logon of an another user. I use CreateProcessWithLogonW from API "advapi32.dll" . When my ASP.NET application...
4
by: Dave | last post by:
I have a global.asax file with Application_Start defined and create some static data there and in another module used in the asp.net application and I realize that static data is shared amongst...
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: 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
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...
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:
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
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,...
0
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...

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.