Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6656995
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:42:42+00:00 2026-05-26T01:42:42+00:00

I am creating an array for some monetary values. I created the array as

  • 0

I am creating an array for some monetary values. I created the array as an integer and realized it needs to be decimal values. When I change the variables to decimals and try and run it, I get “Cannot be implicitly converted from decimal to int.” I hover over the variables and they all appear to be decimals. I remember in the past placing .00M after int’s to force them to be a decimal, but this doesn’t seem to make a difference. Does this make sense to anyone else?

    //Global var
    Decimal lastIndexUsed = -1;
    Decimal[,] quarters = new Decimal[10, 5];
    string[] Branch = new string[10];

       //Calc button
            decimal Q1;
            decimal Q2;
            decimal Q3;
            decimal Q4;

            Q1 = Decimal.Parse(txtQ1.Text);
            Q2 = Decimal.Parse(txtQ2.Text);
            Q3 = Decimal.Parse(txtQ3.Text);
            Q4 = Decimal.Parse(txtQ4.Text);

            lastIndexUsed = lastIndexUsed + 1;
            quarters[lastIndexUsed, 0] = Q1;
            quarters[lastIndexUsed, 1] = Q2;
            quarters[lastIndexUsed, 2] = Q3;
            quarters[lastIndexUsed, 3] = Q4;
            Branch[lastIndexUsed] = txtBranch.Text;

The marked part is the first of many variables which error.

            Decimal row;
            Decimal col;
            Decimal accum;

            //Calculate

            for (row = 0; row <= lastIndexUsed; row++)
            {
                accum = 0;

                for (col = 0; col <= 3; col++)
                {
               ***     accum = accum + quarters[row, col];***
                }
                quarters[row, 4] = accum;
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:42:42+00:00Added an answer on May 26, 2026 at 1:42 am
    Decimal[,] quarters = new Decimal[10, 5];
    

    The index numbers are integers. You can’t index by decimals. The array contains decimals.

    I changed it to this to get it to run and it prints 10.15 like you’d expect

    `//Global var
        int lastIndexUsed = -1;
        Decimal[,] quarters = new Decimal[10, 5];
        string[] Branch = new string[10];
    
       //Calc button
            decimal Q1;
            decimal Q2;
            decimal Q3;
            decimal Q4;
    
            Q1 = Decimal.Parse("10.15");
            Q2 = Decimal.Parse("13");
            Q3 = Decimal.Parse("123.9877");
            Q4 = Decimal.Parse("321");
    
            lastIndexUsed = lastIndexUsed + 1;
            quarters[lastIndexUsed, 0] = Q1;
            quarters[lastIndexUsed, 1] = Q2;
            quarters[lastIndexUsed, 2] = Q3;
            quarters[lastIndexUsed, 3] = Q4;
            Branch[lastIndexUsed] = "hello";
    
            Console.WriteLine(quarters[0,0]);`
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating an array that needs to hold some empty values like this: $my_array['message']
I am creating an array of string objects in PowerShell which needs to be
I am creating a PHP function that will take some values, one of which
Im having some issues creating an array of objects in javascript Please see my
Why is it that for user defined types when creating an array of objects
When creating a 3D array in C#, which is a better way to create
I'm creating a numpy array which is to be filled with objects of a
If you are creating a 1d array in Python, is there any benefit to
What is the prefered method for creating a byte array from an input stream?
i'm attempting to instantiate a bunch of sounds by creating a string array containing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.