How do you guys actually use the StreamReader
to read the .txt file and match with two of my Combobox's text such as SGD - Singapore Dollar and USD - US Dollar so that it writes on the label that shows the number of 1.26?
Exchange.txt:
SGD - Singapore Dollar || USD - US Dollar = 1.26
Here's the code:
private void GetExchangeRate()
{
using (StreamReader sr = new StreamReader("Exchange.txt"))
{
string[] store = new string[100];
int index = 0;
string line;
while ((line = sr.ReadLine()) != null)
{
store[index] = line;
index++;
lblexchange.Text = sr.ReadLine();
}
}
}
private void tocountry_SelectedIndexChanged(object sender, EventArgs e)
{
btnupdate.Enabled = true;
txtvalue.Enabled = true;
GetExchangeRate();
}
In the end, the label did not show the value of 1.26. I don't know what's wrong with it. I need help