473,503 Members | 479 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Application.Run Error

I start my applicaiton from sub Main as follows:

<STAThread()>Public Sub Main()
Dim MainForm As frm_Main = New frm_Main
Application.Run(MainForm)
End Sub

In the MainForm, I show a Progress Form as follows:

Private Sub get_Listing()
Dim prform as New ProgBarForm (this is a form I created with a cancel button)
prform.Show()
dim finished as boolean
While not finished
.....Do Something to get my listing items
Application.DoEvents
'Cancel is a property in prform set to True if Cancel button is clicked
.....If prform.Cancel then finished=True
wend
prform.close
End Sub

I get an error in sub main on the Application.Run Line stating that an error
has occured in an external component. However, if I start my application by
setting my Mainform as the Start-Up form then I don't get the error. Only
when I start my application from sub main do I get the error. I have tried
showing Mainform from sub main using MainForm.ShowDialog and still get the
same error.
--
Dennis in Houston
Nov 21 '05 #1
3 1348
The progress form is declared in your main form I take it.

Do you call this progress dialog more than once?

I've noticed that you aren't disposing of the progress form when you close it.

What code, if any do you have in your progress form? Behind the 'cancel'
button should only be 'Me.Close()' & nothing else.

What is the process of listing things you are performing whilst the progress
form is shown? Are you calling another sub?

Awaiting your response.

"Dennis" wrote:
I start my applicaiton from sub Main as follows:

<STAThread()>Public Sub Main()
Dim MainForm As frm_Main = New frm_Main
Application.Run(MainForm)
End Sub

In the MainForm, I show a Progress Form as follows:

Private Sub get_Listing()
Dim prform as New ProgBarForm (this is a form I created with a cancel button)
prform.Show()
dim finished as boolean
While not finished
....Do Something to get my listing items
Application.DoEvents
'Cancel is a property in prform set to True if Cancel button is clicked
....If prform.Cancel then finished=True
wend
prform.close
End Sub

I get an error in sub main on the Application.Run Line stating that an error
has occured in an external component. However, if I start my application by
setting my Mainform as the Start-Up form then I don't get the error. Only
when I start my application from sub main do I get the error. I have tried
showing Mainform from sub main using MainForm.ShowDialog and still get the
same error.
--
Dennis in Houston

Nov 21 '05 #2
See my response below.

"Crouchie1998" wrote:
The progress form is declared in your main form I take it. Yes, it's delcared in the Module that contains the Sub Main
Do you call this progress dialog more than once? No.
I've noticed that you aren't disposing of the progress form when you close it. I added that after the prform.Close statement below (prform.Dispose) but get
the same result.
What code, if any do you have in your progress form? Behind the 'cancel'
button should only be 'Me.Close()' & nothing else. The only code behind the cancel button is a statement to set a property
(prform.Cancel to True. I don't close the form here but instead rely on the
prform.close in my code below.
What is the process of listing things you are performing whilst the progress
form is shown? Are you calling another sub? Yes, I am getting Files and File information from a sub I call Get_FileInfo
but this works fine when I use the mainform as startup instead of sub Main.
Awaiting your response.

"Dennis" wrote:
I start my applicaiton from sub Main as follows:

<STAThread()>Public Sub Main()
Dim MainForm As frm_Main = New frm_Main
Application.Run(MainForm)
End Sub

In the MainForm, I show a Progress Form as follows:

Private Sub get_Listing()
Dim prform as New ProgBarForm (this is a form I created with a cancel button)
prform.Show()
dim finished as boolean
While not finished
....Do Something to get my listing items
Application.DoEvents
'Cancel is a property in prform set to True if Cancel button is clicked
....If prform.Cancel then finished=True
wend
prform.close
End Sub

I get an error in sub main on the Application.Run Line stating that an error
has occured in an external component. However, if I start my application by
setting my Mainform as the Start-Up form then I don't get the error. Only
when I start my application from sub main do I get the error. I have tried
showing Mainform from sub main using MainForm.ShowDialog and still get the
same error.
--
Dennis in Houston

Nov 21 '05 #3
Wrap the call to Application.Run in a try block. When the exception
hits, log the exception and it's stack trace. Perhaps that would give
some clues as to what is happening.

You might also try stepping through the code to see if you can narrow
down where the exception is occurring.

Nov 21 '05 #4

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

Similar topics

0
2901
by: Cenray | last post by:
How to generate a web request from a Winform Application using a WebService? In a C# Windows Application, when I try to genrate a web request using the following code, it is woking fine ...
0
4989
by: Rhon Stewart via DotNetMonster.com | last post by:
Hi please visit this link : http://www.eggheadcafe.com/articles/pfc/selfupdater.asp I followed all the steps for listed on the link , when I execute the application it it gives me the following...
6
635
by: Javier Cortés Cortés | last post by:
i am getting this error when i am trying to access any file(with the ext. aspx) from my remote server. the error is : Server Error in '/' Application....
1
3144
by: Keith | last post by:
All, I have been told this is an ASP.NET issue and not an IIS issue, so I am posting this here. I have a problem with ASP.NET returning an HTTP 500 error when trying to run ASPX pages on...
3
1616
by: Matthew Louden | last post by:
My ASP.NET application is running without error in my local machine (IIS PWS). However, once I upload all the ASPX files to the remote IIS machine with Windows Server 2003 OS, it no longer works. ...
3
4884
by: Damian | last post by:
Hi everyone I'm having an issue with one of our applications. I'm getting the following error when attempting to log in to the site: Server Error in 'xxxxxxxxxxxxxxxx' Application....
4
5374
by: tommy | last post by:
hello everbody, i write a little asp-application with forms-authentication. i copy my aspx-files with web.config to my webspace and i get the error above... i tried to set the...
9
1879
by: Wayne Wengert | last post by:
I built an ASP application and it runs fine on my local IIS. I am trying to move the application to my web service (ISP) out on the internet. I've read several of the help articles but they all...
3
375
by: Sean | last post by:
HI There, I am having trouble deploying my .aspx pages to a remote server, I have made changes to the config file and it still returns an error. I have also contacted the server administrator to...
2
1950
by: saggydel | last post by:
I have 3 web application these all are independent to each other. 1 web application have .aspx, .aspx.cs, web.config, .dll and some other Supporting files. I want to make a common setup of all 3...
0
7282
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
7339
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...
1
6995
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
7463
tracyyun
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...
1
5017
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...
0
4678
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...
0
3168
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...
1
738
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
389
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...

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.