Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27225

VS 2010 Input string was not in a correct format.

$
0
0
Every time I enter a number and this happened
"Input string was not in a correct format."


Code:

Private Sub InvoiceLabourCostBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles InvoiceLabourCostBox.TextChanged
        If InvoiceLabourCostBox.Text <> Nothing Then
            Labourcost = Convert.ToDouble(InvoiceLabourCostBox.Text)
            MaterialCost = Convert.ToDouble(InvoiceMaterialCostBox.Text)
            TotalCost = (Labourcost + MaterialCost) * ((VATCost / 100) + 1)
            TotalCostBox.Text = TotalCost
            TotalCostBox.ReadOnly = True

        End If
    End Sub


Also, Is there a way to make it so only numbers can be entered into a textbox.

Viewing all articles
Browse latest Browse all 27225

Trending Articles



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