0

I am using vb.net 2010 version. Lately, it is very strange. Everything I will debug my program, it doesn't pop up or show me any error message. I think I might have change some settings that led to this kind of problem.

Here is my simple code below:

Private Sub PhysicalInventoryToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PhysicalInventoryToolStripMenuItem.Click
        frmPhysicalInventory.MdiParent = Me
        frmPhysicalInventory.Show()
End Sub

Private Sub frmPhysicalInventory_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
     Dim dt = New DataTable()
     dt.columns.add(New DataColumn("qty_big", Type.GetType("System.Int33")))
End Sub

Note in the code, it should encounter a runtime at gettype, the data type should be System.Int32, not Int33. The problem is vb.net does not tell me this error, it will just go out of that line with error and go back to frmPhysicalInventory.Show() and continue execute whatever line is left.

How can I set vb.net to show me runtime errors during debugging? Any help will be greatly appreciated. I am having this problem for several days now.

  • Possible duplicate of [VS2010 does not show unhandled exception message in a WinForms Application on a 64-bit version of Windows](http://stackoverflow.com/questions/4933958/vs2010-does-not-show-unhandled-exception-message-in-a-winforms-application-on-a). TLDR: Use `Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException)` in `Main()`. – John Wu May 16 '17 at 03:02
  • I got this error : 'UnhandledExceptionMode' is not declared. It may be inaccessible due to its protection level. – Sam Cua May 17 '17 at 02:58
  • @johnwu I also have another problem. I show frmlogin in my sub main. frmLogin.show , the problem is after I login, the application just exit. Inside frmlogin, it is calling another form mainmenu and closes itself. My problem is application exit by itself. – Sam Cua May 17 '17 at 03:32
  • When you start the first form in your application, you should start it using [Application.Run()](http://stackoverflow.com/questions/2314514/whats-the-difference-between-application-run-and-form-showdialog) (instead of `Form.Show()`) in order to establish your application's message loop. Without the message loop it'll just exit. – John Wu May 18 '17 at 02:26

0 Answers0