[text] affafafawf

Viewer

copydownloadembedprintName: affafafawf
  1.  Public Class Form6
  2.     Private Sub btnCompute_Click(sender As Object, e As EventArgs) Handles btnCompute.Click
  3.         On Error GoTo MsgDisplay
  4.         txtOutput.Text = txtOne.Text / txtTwo.Text
  5.         Throw New Exception()
  6.  
  7. MsgDisplay:
  8.         If (TypeOf Err.GetException() Is System.InvalidCastException) Then
  9.             MsgBox("You can only divide numbers")
  10.         End If
  11.         If (TypeOf Err.GetException() Is System.DivideByZeroException) Then
  12.             MsgBox("You cannot divide number by zero.")
  13.         End If
  14.     End Sub
  15.  
  16.     Private Sub txtOne_TextChanged(sender As Object, e As EventArgs) Handles txtOne.TextChanged
  17.  
  18.     End Sub
  19.  
  20.     Private Sub txtOne_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtOne.KeyPress
  21.         If Not Char.IsDigit(e.KeyChar) AndAlso Not Char.IsControl(e.KeyChar) Then
  22.             e.Handled = True
  23.         End If
  24.     End Sub
  25.  
  26.     Private Sub txtTwo_KeyPress(sender As Object, e As KeyPressEventArgs) Handles txtTwo.KeyPress
  27.         If Not Char.IsDigit(e.KeyChar) AndAlso Not Char.IsControl(e.KeyChar) Then
  28.             e.Handled = True
  29.         End If
  30.     End Sub
  31. End Class
  32.     End Sub

Editor

You can edit this paste and save as new:


File Description
  • affafafawf
  • Paste Code
  • 18 Sep-2021
  • 1.15 Kb
You can Share it: