我試圖顯示label1
上的貨幣匯率,但我無法弄清楚我應該在label1.Text =
中輸入什麼內容。因此,有人可以引導我沿着C#for循環在組合框中
String[] arr = new string[2];
arr[0] = "US"
arr[1] = "SG"
Combobox1.Items.AddRange(arr);
Combobox2.Items.AddRange(arr);
在combobox1
和combobox2
double[,] value = new double [2,2];
for(int I =0; I<2; I++)
{
value[0,0] = 1; // basically if I chose Combobox1 US and Combobox2 US the rate is 1;
value[0,1] = 1.24; // US to SG
value[1,0] = 0.80; // SG to US
value[1,1] = 1; // SG to SG
Label1.Text =
}
你想在Label1中顯示什麼?不管它是什麼,它都會在循環的第二次運行中給出值(如果你確實需要循環)。你應該在循環之後賦值。 – Schaliasos
就像「1 $ = 1.24SG」(我不怎麼做標誌)? –