|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Application.Run ProblemI have a windows vb.net application. The StatupObject is a Module 'modMain'. In the main sub routine i have the following g_frmMain = New formVMMain System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default Application.Run(New ApplicationContext(g_frmMain)) There is a progress bar in the form which starts everytime a file in a particular folder is updated.so whenever the file is updated the progress bar is initialised and shown in the main Form. The application works fine sometimes but at other times it gives an ArgumentoutofRange Exception at ' Application.Run(New ApplicationContext(g_frmMain))' this line. 'Index was out of Range. Must be non negative and less than the size of the collection.' Any Help will be appreciated. Raj rajendra.mis***@gmail.com wrote:
Show quoteHide quote > Hi... Your problem is not on the application.run object, it's in your form > I have a windows vb.net application. The StatupObject is a Module > 'modMain'. > In the main sub routine i have the following > g_frmMain = New formVMMain > System.Windows.Forms.Cursor.Current = > System.Windows.Forms.Cursors.Default > Application.Run(New ApplicationContext(g_frmMain)) > > > There is a progress bar in the form which starts everytime a file in a > particular folder is updated.so whenever the file is updated the > progress bar is initialised and shown in the main Form. The application > works fine sometimes but at other times it gives an ArgumentoutofRange > Exception at ' Application.Run(New ApplicationContext(g_frmMain))' this > line. 'Index was out of Range. Must be non negative and less than the > size of the collection.' > > Any Help will be appreciated. > > Raj > formVMMain. Tell the compiler to break on all exceptions (Debug -> Exceptions) and then hopefully it will break where the actual exception is happening. Chris Hi Chris/raulavi...
Thanks for the prompt replies I am not able to catch the exception except at the Application.Run. The BreakPoints at FormvmMain and elsewhere do not come up...it goes to this line and throws it...If i handle the exception at Application.run it goes to catch...but then the application exits itself. Raj had the same prob you describe... but it was on
Private Sub me_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint some times it just crashed after displaying correctly...meaning the form was perfectly displayed/working but, when I did call another window and back then it crashed. might help some one if not you. Show quoteHide quote "rajendra.mis***@gmail.com" wrote: > Hi... > I have a windows vb.net application. The StatupObject is a Module > 'modMain'. > In the main sub routine i have the following > g_frmMain = New formVMMain > System.Windows.Forms.Cursor.Current = > System.Windows.Forms.Cursors.Default > Application.Run(New ApplicationContext(g_frmMain)) > > > There is a progress bar in the form which starts everytime a file in a > particular folder is updated.so whenever the file is updated the > progress bar is initialised and shown in the main Form. The application > works fine sometimes but at other times it gives an ArgumentoutofRange > Exception at ' Application.Run(New ApplicationContext(g_frmMain))' this > line. 'Index was out of Range. Must be non negative and less than the > size of the collection.' > > Any Help will be appreciated. > > Raj > > <rajendra.mis***@gmail.com> schrieb
Show quoteHide quote > Hi... What does the callstack window show when the exception occurs? Please > I have a windows vb.net application. The StatupObject is a Module > 'modMain'. > In the main sub routine i have the following > g_frmMain = New formVMMain > System.Windows.Forms.Cursor.Current = > System.Windows.Forms.Cursors.Default > Application.Run(New ApplicationContext(g_frmMain)) > > > There is a progress bar in the form which starts everytime a file in > a particular folder is updated.so whenever the file is updated the > progress bar is initialised and shown in the main Form. The > application works fine sometimes but at other times it gives an > ArgumentoutofRange Exception at ' Application.Run(New > ApplicationContext(g_frmMain))' this line. 'Index was out of Range. > Must be non negative and less than the size of the collection.' > > Any Help will be appreciated. Include the "non-user code" (or "external code") in the window's context menu. Armin on doing a quick watch it shows the following error
Application.Run(g_frmMain) Run-time exception thrown : System.InvalidOperationException - It is invalid to start a second message loop on a single thread. Use Application.RunDialog or Form.ShowDialog instead. while the popup message shows the following " Index was out of range. Must be non-negative and less than the size of the collection. Paramater name: index " I have tried using Form.showdialog it gives me the same...for 10 times it will work fine but sometime it wont... Raj Why don't you start your program (Vb.Net 2003) from your main sub like;
g_frmMain.Show Applicaton.Run Why are you using the new application context? Is this a VB.Net 2005 thing (I use only 2003 due the problems with 2005 that I've read in this newsgroup). -- Show quoteHide quoteDennis in Houston "rajendra.mis***@gmail.com" wrote: > on doing a quick watch it shows the following error > > Application.Run(g_frmMain) Run-time exception thrown : > System.InvalidOperationException - It is invalid to start a second > message loop on a single thread. Use Application.RunDialog or > Form.ShowDialog instead. > > while the popup message shows the following > " > Index was out of range. Must be non-negative and less than the size of > the collection. > Paramater name: index > " > I have tried using Form.showdialog it gives me the same...for 10 times > it will work fine but sometime it wont... > > Raj > >
how do I call a SQL Server stored procedure?
Retrieve data from xml document Determining the Browser and event.keyCode vs. event.which blank form when debugging difference between ME and MYCLASS Inheritance doubt. hair cross cursor advice needed for a good book to make good database applications VB.Net & SQL2005 Stored Procedures How select from 2 ADO.NET DataTables? |
|||||||||||||||||||||||