Why does the code below have the error in the subject of my post? I don't get it.... How do I make it go away. Any help is appreciated
Partial Class NIR_Approvals_NIA
Inherits System.Web.UI.Page
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged
Dim unitCost As Decimal = CDec(CType(DetailsView1.FindControl("Label4"), Label).Text)
Dim annualSqty As Decimal = CDec(CType(DetailsView1.FindControl("Label5"), Label).Text)
Dim annualSales As Decimal = CDec(CType(DetailsView1.FindControl("Label6"), Label).Text)
MathFormulas(unitCost, annualSqty, annualSales)
NIAUPD.Update()
End Sub
Private Sub MathFormulas(ByVal unitCost As Decimal, ByVal annualSqty As Decimal, ByVal annualSales As Decimal)
Dim costReturn As Decimal = CDec(CType(DetailsView1.FindControl("Label1"), Label).Text)
Dim profitReturn As Decimal = CDec(CType(DetailsView1.FindControl("Label2"), Label).Text)
Dim totalReturn As Decimal = CDec(CType(DetailsView1.FindControl("Label3"), Label).Text)
costReturn = unitCost * annualSqty
profitReturn = annualSales - costReturn
totalReturn = profitReturn / annualSales
End Sub
End Class
The main line of code throwing the exception is Dim unitCost As Decimal = CDec(CType(DetailsView1.FindControl("Label4"), Label).Text)