Solved

Error:  'ToDecimal' is not a member of 'convert'.

Posted on 2015-01-30
4
185 Views
Last Modified: 2015-01-30
Hi Experts,

I'm getting the following error:

cervert-error.png
Here's my code:

    Dim WorksheetID As Integer
    Dim _CRDBTotal As Decimal = 0
    Dim _AdjustedTotal As Decimal = 0
    Dim _ProposedTotal As Decimal = 0
    Dim _ActCostTotal As Decimal = 0
    Dim _EstCostTotal As Decimal = 0

    Protected Sub GridServices_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridServices.RowDataBound

        If e.Row.RowType = DataControlRowType.DataRow Then
            _EstCostTotal += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "EstimatedCost"))
            _ActCostTotal += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "ActualCost"))
            _ProposedTotal += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Proposed"))
            _AdjustedTotal += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "Adjusted"))
            _CRDBTotal += Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "CreditDebit"))
        End If

        If Convert.ToInt32(Convert.ToDecimal(DataBinder.Eval(e.Row.DataItem, "CreditDebit"))) < 0 Then
            e.Row.Cells(6).ForeColor = Drawing.Color.Red
        End If

        If e.Row.RowType = DataControlRowType.Footer Then
            ' Cell 0
            e.Row.Cells(1).Text = "Totals:"
            e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Right

            ' Cell 1 - Estimated Total
            e.Row.Cells(2).Text = _EstCostTotal.ToString("c")
            e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Right
            ' e.Row.Cells(2).CssClass = "pGrandTotal"

            ' Cell 2 - Actual Total
            e.Row.Cells(3).Text = _ActCostTotal.ToString("c")
            e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Right
            ' e.Row.Cells(3).CssClass = "pGrandTotal"

            ' Cell 3 - Proposed Total
            e.Row.Cells(4).Text = _ProposedTotal.ToString("c")
            e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Right
            e.Row.Cells(4).ForeColor = Drawing.Color.DarkGreen
            ' e.Row.Cells(4).CssClass = "pGrandTotal"

            ' Cell 4 - Adjusted Total
            e.Row.Cells(5).Text = _AdjustedTotal.ToString("c")
            e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Right
            e.Row.Cells(5).ForeColor = Drawing.Color.DarkGreen
            ' e.Row.Cells(5).CssClass = "pGrandTotal"

            ' Cell 4 - Credit Debit
            e.Row.Cells(6).Text = _CRDBTotal.ToString("c")
            e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Right
            ' e.Row.Cells(6).CssClass = "pGrandTotal"

            If Convert.ToInt32(_CRDBTotal) < 0 Then
                e.Row.Cells(6).ForeColor = Drawing.Color.Red
            End If

        End If

    End Sub

Open in new window


Can someone tell me how I can fix this?
0
Comment
Question by:cdemott33
  • 2
4 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 40580110
Do you have:

Imports System

...at the top of your file?
0
 

Author Comment

by:cdemott33
ID: 40580203
I do... but listen to this.

This only happens when I attempt to Debug from Visual Studio.  If I move the aspx file from my laptop to my server and load the page the bug goes away???  So it must be a local IIS issue?.... I guess?  

Any idea how to fix this?
0
 
LVL 18

Expert Comment

by:Elvio Lujan
ID: 40580349
i see convert with "c" and the Convert calss is with capital "C"
0
 

Author Closing Comment

by:cdemott33
ID: 40580520
That seemed to work.  Thank you.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question