473,320 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,320 software developers and data experts.

Sporadic problem with ShowDialog - Application Hangs

I am having a problem in a .NET 2.0 / Visual Studio 2003 application. Most
of the time, the app works fine. But occasionally, I get to the point where
I execute this code:

frmPolStatus.Refresh()
frmPolStatus.ShowDialog()
...

The application hangs up on the ShowDialog method for this Windows form.
When I look at the stack, I get the following information:

system.windows.forms.dll!System.Windows.Forms.Appl ication.ComponentManager.System.Windows.Forms.Unsa feNativeMethods+IMsoComponentManager.FPushMessageL oop(int dwComponentID = 1, int reason = 4, int pvLoopData = 0) + 0x49d bytes

system.windows.forms.dll!ThreadContext.RunMessageL oopInner(int reason = 4,
System.Windows.Forms.ApplicationContext context =
{System.Windows.Forms.Application.ModalApplication Context}) + 0x1f3 bytes

system.windows.forms.dll!ThreadContext.RunMessageL oop(int reason = 4,
System.Windows.Forms.ApplicationContext context =
{System.Windows.Forms.Application.ModalApplication Context}) + 0x50 bytes

system.windows.forms.dll!System.Windows.Forms.Appl ication.RunDialog(System.Windows.Forms.Form form = {chubb.csi.express.common.frmPolStatus}) + 0x34 bytes

system.windows.forms.dll!System.Windows.Forms.Form .ShowDialog(System.Windows.Forms.IWin32Window owner = <undefined value>) + 0x6ab bytes

system.windows.forms.dll!System.Windows.Forms.Form .ShowDialog() + 0xe bytes

Like I said, this code works fine most of the time. I just can't explain
why it's happening sometimes. Any suggestions would be appreciated.

Thanks!
Dave P.
Jun 27 '08 #1
3 3743
On 2008-05-22, DaveP <Da***@discussions.microsoft.comwrote:
I am having a problem in a .NET 2.0 / Visual Studio 2003 application. Most
2003? That's 1.1 not 2.0 :)
of the time, the app works fine. But occasionally, I get to the point where
I execute this code:

frmPolStatus.Refresh()
frmPolStatus.ShowDialog()
...

The application hangs up on the ShowDialog method for this Windows form.
When I look at the stack, I get the following information:

system.windows.forms.dll!System.Windows.Forms.Appl ication.ComponentManager.System.Windows.Forms.Unsa feNativeMethods+IMsoComponentManager.FPushMessageL oop(int dwComponentID = 1, int reason = 4, int pvLoopData = 0) + 0x49d bytes

system.windows.forms.dll!ThreadContext.RunMessageL oopInner(int reason = 4,
System.Windows.Forms.ApplicationContext context =
{System.Windows.Forms.Application.ModalApplication Context}) + 0x1f3 bytes

system.windows.forms.dll!ThreadContext.RunMessageL oop(int reason = 4,
System.Windows.Forms.ApplicationContext context =
{System.Windows.Forms.Application.ModalApplication Context}) + 0x50 bytes

system.windows.forms.dll!System.Windows.Forms.Appl ication.RunDialog(System.Windows.Forms.Form form = {chubb.csi.express.common.frmPolStatus}) + 0x34 bytes

system.windows.forms.dll!System.Windows.Forms.Form .ShowDialog(System.Windows.Forms.IWin32Window owner = <undefined value>) + 0x6ab bytes

system.windows.forms.dll!System.Windows.Forms.Form .ShowDialog() + 0xe bytes

Like I said, this code works fine most of the time. I just can't explain
why it's happening sometimes. Any suggestions would be appreciated.

Thanks!
Dave P.
Well... Most likely, it's something the form is doing in it's
startup. Can you post some of the forms code?

--
Tom Shelton
Jun 27 '08 #2
Not sure I understand why you would be refreshing the form prior to
showing it. Its possible you're dealing with a threading issue with
the refresh working on a separate thread and not finishing before
ShowDialog(). If you must refresh the form before showing it, try a
System.Threading.Thread.Join() between the two and see what that does.

Jun 27 '08 #3
Thanks for your help so far. Here is the code for the form that I'm trying
to display with the ShowDialog. It's very basic:

Option Explicit On
Public Class frmPolStatus
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents dfStatus As System.Windows.Forms.Label
<System.Diagnostics.DebuggerStepThrough()Private Sub
InitializeComponent()
Me.dfStatus = New System.Windows.Forms.Label
Me.SuspendLayout()
'
'dfStatus
'
Me.dfStatus.BackColor = System.Drawing.Color.Silver
Me.dfStatus.Font = New System.Drawing.Font("Arial", 10.2!,
System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0,
Byte))
Me.dfStatus.Location = New System.Drawing.Point(24, 16)
Me.dfStatus.Name = "dfStatus"
Me.dfStatus.Size = New System.Drawing.Size(352, 40)
Me.dfStatus.TabIndex = 0
Me.dfStatus.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
'
'dbStatus
'
Me.AutoScale = False
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 15)
Me.AutoScroll = True
Me.ClientSize = New System.Drawing.Size(400, 80)
Me.Controls.Add(Me.dfStatus)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "dbStatus"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScree n
Me.Text = "Policy Status"
Me.ResumeLayout(False)

End Sub

#End Region

End Class

Jun 27 '08 #4

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

Similar topics

0
by: Bob Murdoch | last post by:
I'm receiving a sporadic error: "The remote procedure call failed and did not execute", when calling the following page: <%@ language="JavaScript" %> <% var vPath =...
0
by: Tim Haughton | last post by:
I've just released an article on using Test Driven Development with C# and Windows Forms. GUI's are often difficult to test, so I thought it might be of interest. The article along with the...
3
by: kathyk | last post by:
Hi All, I am using Access 2003 on machines with windows 2000 and XP. The problem I'm having started only after we got a new image for our PC's. This database app has been around for awhile and...
3
by: pnp | last post by:
Hi all, I have developed an app in C# and I have used some of the Infragistics components in it. The problem is that while one is playing with the windows within the mdi container exceptions occur...
1
by: NanoWizard | last post by:
Enclosed below is a class that contains one member item called _frm. It is just a standard System.Windows.Forms.Form class defined elsewhere (just disregard the definition of the object). My...
3
by: sameer | last post by:
Hi All, i have an asp.net application which has got sql server 2000 behind the scenes. Very simple application, all it does is extract the data from the databse and display it in the grid. But...
0
by: Sven Franz | last post by:
I develop an MDI-Application in vb.net (2002). But I got som errors, I can`t handle. When I have opened some MDI-Children and also closed them, my application crashed when I switch to an other...
4
by: zhouzuo | last post by:
Hi I want to re-write a C# application(exe) to C# DLL. This application starts by myApp.MainApplication app = new myApp.MainApplication(); Application.Idle += new...
3
by: Michel Couche | last post by:
Hello, I have an ASP.Net application that uses the Wizard control to build a newsletter. There are three steps in the wizard. The customer's specific design data are loaded from a database in...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.