Windows Exception in Dot Net

As we have declared as Int16 in the program the input must be entered as a number in the Input Textbox. But instead if we enter a Decimal Number. Actually this is a format exception Error. But instead of giving separate exception for format and Overflow errors. We can give system Exception as a common error. This windows exception handles all the Known and Unknown Errors that is specified.

Private Sub CoversionButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CoversionButton.Click
Decimal1 = System.Double.Parse(InputTextBox.Text)
Decimal2 = 10.11 Decimal2 += 10.645 ResultListBox.Items.Add(Decimal2.ToString("0.00"))
Dim Stri = Decimal2.ToString("0.00")
ResultListBox.Items.Add("ToString():" & Stri)
Decimal1 = System.Convert.ToSingle("decimal2")
Catch ex As SystemException MessageBox.Show(ex.ToString, "Unknown Error ", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try

End Sub

Related Articles

Object Serialisation in dot net

This article provides an overview of the serialization used in Microsoft .NET and the usage of the same.For example, serialization is used to save session state in ASP.NET and to copy objects to the clipboard in Windows Forms. It is also used by remoting to pass objects by value from one application domain to another.

More articles: Dot Net


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: