Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
C# - Bug
Message
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
C# - Bug
Divers
Thread ID:
01053289
Message ID:
01053289
Vues:
48
I am in a C# class and am having a problem with the Masked TextBox. I must not understand something. The two masked TextBoxes are for the Base Price and the SubTotal. They have the input mask of 999,999.99 foir the base price and 99,999.99 for the SubTotal. I get an error, but it's not even a complete error; it says, "Input string not in correct format." See the lines marked with the double asterisks below (**).
//The following line is put ahead of all the below code:
 private decimal decSubTotal = 0M;

 private void calculateButton_Click(object sender, EventArgs e)
 {
   string strMessageString;
   //Calculate the cost of the vehicle.
   if (this.basePriceMaskedTextBox.Text != "")
     {
     //Convert from Text to Decimal value.
   **  decSubTotal = decimal.Parse(this.basePriceMaskedTextBox.Text);
     if (this.tradeInAllowanceMaskedTextBox.Text != "")
       {
       decTradeInAllowance = 
        ** decimal.Parse(this.tradeInAllowanceMaskedTextBox.Text);
         decSubTotal += decTradeInAllowance;
         this.subTotalLabel.Text = decSubTotal.ToString("C");
       }
     }
  }
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform