Value of type Decimal cannot be converted to 1 dimensional array of Decimal

Discussion in 'Software' started by Neal, Mar 20, 2011.

  1. Neal


    Mar 20, 2011
    Likes Received:

    I am taking my first quarter of computer programming, and I am running into a brick wall trying to understand jagged arrays in Visual Studio 2010. At the moment I am working on a program that uses two two dimensional jagged arrays, and I cannot figure out how to properly pass information into one of them. I have posted the code below. The part that is in bold is where the error message pops up that "Value of type decimal cannot be converted to 1 dimensional array of Decimal." Help!

    If IsNothing(g_decChargesArray(g_intActivePatientNumber)) Then
    numVisits = 0
    Dim decTemp(g_intActivePatientNumber) As Decimal
    g_decChargesArray(g_intActivePatientNumber) = decTemp
    Dim strTemp(0) As String
    strTemp(0) = g_dtmDate.ToString("d")
    g_strVisit(g_intActivePatientNumber) = strTemp
    numVisits = g_decChargesArray(g_intActivePatientNumber).Length
    End If
    ReDim Preserve g_strVisit(g_strVisit.Length)
    ReDim Preserve g_decChargesArray(g_decChargesArray.Length)
    decCharges = CalcCharges()
    If decCharges = -1 Then
    MessageBox.Show("The Following Fields Will Only Accept Positive Numeric Values:" & vbCrLf & vbCrLf & "Length of Stay (Must be entered as whole number!)" & vbCrLf &
    "Medical Charges" & vbCrLf & "Surgical Charges" & vbCrLf & "Lab Fees" & vbCrLf & "Physical Rehab Fees" &
    vbCrLf & vbCrLf & "Please Review Your Entries and Correct Any Errors!")
    g_decChargesArray(g_intActivePatientNumber) = decCharges
    g_strVisit(g_intActivePatientNumber)(numVisits) = g_decTotal

    End If
    Neal, Mar 20, 2011
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.