Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42732

conversion problem

$
0
0
Hi,

I have two codes;

which when I change the value of the value from Full Pay to No Pay in the cmbpaystatus -

I receive InvalidCastException was unhandled.

Conversion from string "" to type 'Double' is not valid.

Code:

Private Sub txtamt_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtamt.TextChanged

        Dim tot As Integer = 0
      tot += TxtSubTotal.Text - txtamt.Text

        txtBal.Text = tot.ToString("#,0.00")

        If txtBal.Text = "0.00" Then
            cmbpaystatus.Text = "Full Pay"
                End If

    End Sub

Code:

  Private Sub cmbpaystatus_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbpaystatus.SelectedIndexChanged


        Dim tot As Integer = 0

        If cmbpaystatus.Text = "Full Pay" Then
            txtamt.Text = TxtSubTotal.Text
            txtamt.Enabled = False
        End If

        If cmbpaystatus.Text = "No Pay" Then
            txtamt.Clear()
            txtamt.Text = ToString("#,0.00")
        End If

        If cmbpaystatus.Text = "Part Pay" Then
            txtamt.Clear()
            txtamt.Enabled = True
        End If
    End Sub

Thanks

Viewing all articles
Browse latest Browse all 42732

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>