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 7972769
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T07:56:58+00:00 2026-06-04T07:56:58+00:00

I have written a code that displays 6 DataGridView tables with values from excel

  • 0

I have written a code that displays 6 DataGridView tables with values from excel that contain exchange rates for euros and us dollars from 6 different banks. The exchange rates are imported from excel file. Now i have to compare each of them and display the min value for euro buy rate (Куповен курс) and max value for sell rate (Продажен/Откупен курс) and min value for dollar buy rate (Куповен курс) and max value for sell rate (Продажен/Откупен курс). I need some help with C# code that will compare those values and display them in a TextBox by clicking the Compare button.

Here is pic from my app:

http://uploadpic.org/v.php?img=CYRmqhbE6F

I tried with this code, but give me error:

private void button7_Click(object sender, EventArgs e)
    {

        string s = dataGridView1.Rows[1].Cells[1].Value.ToString();
        string t = dataGridView2.Rows[0].Cells[6].Value.ToString();
        string k = dataGridView3.Rows[0].Cells[1].Value.ToString();
        string l = dataGridView4.Rows[0].Cells[4].Value.ToString();
        string m = dataGridView5.Rows[0].Cells[2].Value.ToString();
        string n = dataGridView6.Rows[0].Cells[3].Value.ToString();



        string[] kupoven = new string[] { s,t,k,l,m,n};



        int length = kupoven.Length;

        int last = length - 1;

        int largest = kupoven[];

        for (int i = 1; i <= length / 2; i++)
        {

            if (kupoven[i] > kupoven[last] && kupoven[i] > largest) largest = arr[i];

            else if (kupoven[last] > largest) largest = kupoven[last];

            last--;

        }

        return largest;


    }

With this i put all euro values in strings(s,t,k,l,m,n), then i put them in array, and then i try to get the max value from the array. I think the problem is with type string.

  • 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-06-04T07:56:59+00:00Added an answer on June 4, 2026 at 7:56 am

    That code you posted most likely doesn’t compile… you should always post code that compiles, unless your question is about code that’s not compiling. I would strongly recommend that you try to post sscce compliant questions: http://sscce.org/

    With that said, if you want the maximum value I would do something along the lines:

    private void button7_Click(object sender, EventArgs e)
    {
        double s = double.Parse(dataGridView1.Rows[1].Cells[1].Value.ToString());
        double t = double.Parse(dataGridView2.Rows[0].Cells[6].Value.ToString());
        double k = double.Parse(dataGridView3.Rows[0].Cells[1].Value.ToString());
        double l = double.Parse(dataGridView4.Rows[0].Cells[4].Value.ToString());
        double m = double.Parse(dataGridView5.Rows[0].Cells[2].Value.ToString());
        double n = double.Parse(dataGridView6.Rows[0].Cells[3].Value.ToString());
    
        double[] kupoven = new double[] { s,t,k,l,m,n};
        double max = kupoven.Max();
    }
    

    Of course, that would only be store the maximum value in the local variable max. To display the max in a text box you would have to write some more code. I also feel like that simply displaying the maximum value may not be sufficient, given that you’re comparing the exchange rate between different banks.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

so far my cURL code i have written displays the page that I would
I have written a small plugin that displays tweets. following is the code that
I'have written a simple code, that gets accelerometer&orientation meter and display some graphics based
I have written code that opens 16 figures at once. Currently, they all open
I have written some code to ensure that items on an order are all
I have written code to perform a function that could take a while to
I have written a PHP function to take a video embed code that has
I have written a cascading drop down list using JQuery. The code that I
I have written a code for adding multiple keys for a dictionary for that
I have written some WebGL code, actually I am playing with the examples that

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.