Note that there are some explanatory texts on larger screens.

plurals
  1. POComparing values from dataGridView tables in VS2010 - C#
    primarykey
    data
    text
    <p>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.</p> <p>Here is pic from my app:</p> <p><a href="http://uploadpic.org/v.php?img=CYRmqhbE6F" rel="nofollow">http://uploadpic.org/v.php?img=CYRmqhbE6F</a></p> <p>I tried with this code, but give me error:</p> <pre><code>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 &lt;= length / 2; i++) { if (kupoven[i] &gt; kupoven[last] &amp;&amp; kupoven[i] &gt; largest) largest = arr[i]; else if (kupoven[last] &gt; largest) largest = kupoven[last]; last--; } return largest; } </code></pre> <p>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.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload