Thursday, October 12, 2017

ตัวอย่างการใช้งาน Decimal.TryParse กับ TextBox มากกว่า 1 TextBox

    
Private Sub TextBox_Leave(ByVal sender As Object, _
        ByVal e As System.EventArgs) _
        Handles TextBox1.Leave, _
                TextBox2.Leave, _
                TextBox3.Leave, _
                TextBox4.Leave

        Dim result As Decimal
        If Not Decimal.TryParse(sender.Text.Trim, result) Then
            result = 0.0
        End If
        sender.Text = result.ToString("##0.00")

End Sub

No comments:

Post a Comment