Conversions

Aug 22 2014 4:57 AM



This is the error message I'm receiving and I don't know how to fix it:

Cannot implicitly convert type 'double' to 'System.Windows.Forms.Label'  and here's my code: 

 
using System; 

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

namespace ClassExample3

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

const double NTBKPrice = 7500;

const double TBLTPrice = 5000;

const double DSKTPrice = 15000;

const double PRTRPrice = 3000;

const double HDRVPrice = 2500;

const double VATRate = 0.1;

const double CashRate = 0.01;

const double DebitRate = 0.02;

const double PointsRate = 100;

private void toolTip1_Popup(object sender, PopupEventArgs e)

{

}

private void btnCalc_Click(object sender, EventArgs e)

{

//

double dblQty;

double dblDiscAmt;

double dblAmtOwng;

double dblVATAmt;

double dblPts;

double dblNTBKPrice;

double dblTBLTPrice;

double dblDSKTPrice;

double dblPRTRPrice;

double dblHDRVPrice;

double dblVATRate;

double dblCashRate;

double dblDebitRate;

double dblPointsRate;

double dblItemCode;

//

dblQty = Convert.ToDouble(txtQty.Text);

//

string ItemCode = txtItemCode.Text;

string CustPhoneNo = txtCustPhoneNo.Text;

string PayType= txtPayType.Text;

if (ItemCode == "NTBK")

{

dblAmtOwng = dblQty * NTBKPrice;

}

else if (ItemCode == "TBLT")

{

dblAmtOwng = dblQty * TBLTPrice;

}

else if (ItemCode == "DSKT")

{

dblAmtOwng = dblQty * DSKTPrice;

}

else if (ItemCode == "PRTR")

{

dblAmtOwng = dblQty * PRTRPrice;

}

else if (ItemCode == "HDRV")

{

dblAmtOwng = dblQty * HDRVPrice;

}

else if (PayType == "Cash")

{

dblDiscAmt = dblAmtOwng * CashRate;

}

else if (PayType == "Debit")

{

dblDiscAmt = dblAmtOwng * DebitRate;

}

AmtOwng = dblAmtOwng - dblDiscAmt;

if (chkLoyCard.Checked == true)

{

dblPointsRate = dblAmtOwng / dblPointsRate;

}

dblVATAmt = dblAmtOwng * dblVATRate;

dblAmtOwng = dblAmtOwng + dblVATAmt;

//

lblAmtOwng.Text = dblAmtOwng.ToString("C2");

lblDiscAmt.Text = dblDiscAmt.ToString("C2");

lblVATAmt.Text = dblVATAmt.ToString("C2");

lblPts.Text = dblPts.ToString("C2");

  

 


 


Answers (1)