Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

First time my app hits an exception there is a long pause before it resumes

Posted on 2004-08-11
5
Medium Priority
?
282 Views
Last Modified: 2010-04-23
Hi,

Im trapping an error with the usall

Try
      '//Code
Catch EX As Exception
      '// Code
End Try

but when running my app, the first time I get an exception there is a long pause at the "Catch EX As Exception" before it resume's then after that the Exception is caught really fast an the appication flows smoothly?

?? Any Ideas ??

The delay still occurs even if I specify the error type with

Catch ex As System.ObjectDisposedException
0
Comment
Question by:emub
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 25

Expert Comment

by:RonaldBiemans
ID: 11774587
I think that has to do with the JIT (Just In Time)  compiler, the first time it is used it hasn't been cached yet.

Regarding your problem, I know this is related to the solution I gave in a previous thread.
Just a thought you don't have to use a collection, if you set owner property each "child" window to me
you can use the me.ownedforms to check which are active

so when you create

      Dim oNewForm As New frmDisplayRecord(iRecordToOpen)
      oNewForm.StartPosition = FormStartPosition.CenterScreen
      oNewForm.TopMost = True
      oNewForm.Owner = Me  <---  ADD this line
      oNewForm.Focus()
      frmMain.oFormCollection.Add(oNewForm)

you can use

        Dim oForm2 As Form
        For Each oForm2 In Me.OwnedForms
              oform2.activate
              .. or oform2.whatever
        Next


if you do it this way you won't have to catch the error
0
 

Author Comment

by:emub
ID: 11774963
Hi, Sorry you Lost me a little there,  I remembe I as testing the relivant for to see if it was still active before I tied to bring it to focus?
0
 

Author Comment

by:emub
ID: 11774992
You saing I remove the whole collections thing? And just use the .OwnedForms array to keep track of all the forms I have open?  If so I presume once a use closes a form its automatically removed from the Parent.OwnedForms array?
0
 
LVL 25

Accepted Solution

by:
RonaldBiemans earned 2000 total points
ID: 11775058
Yes it is emub

so

sorry if I wasn't clear

For Each oForm In frmMain.ownedforms
      If oForm.Tag = iRecordToOpen Then
           oForm.BringToFront()
           oForm.activate
           bLoadNewForm = False
           Exit For
      End If
Next
0
 

Author Comment

by:emub
ID: 11775414
Yea there worked great, the actual amount of coding for the Form management was much less that my orginal idea.

thx
0

Featured Post

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question