i run a ATM project and here is my problem
i got a winforms login with 2 textboxes (username & nip)
i got a textfile defining different username and their nip:
Korben Dallas,D001
Jerry Cann,C001
Eric Clapton,C002
so here is my code
private void button2_Click(object sender, EventArgs e)
{
string line;
bool trouve = false;
string nip = textBox1.Text + "," + textBox2.Text;
StreamReader sr = new StreamReader(@"C:\Users\cdi\Desktop\Clients.txt");
while ((line = sr.ReadLine()) != null)
{
if (!trouve)
{
int x = string.Compare(line, nip);
if (x == 0)
{
// MessageBox.Show("ok");
Transaction tr = new Transaction();
tr.Show();
this.Hide();
trouve = true;
break;
}
trouve = false;
}
}
if (!trouve)
MessageBox.Show("error");
}
}
this code is working well
but my problem is ,once my winforms transaction is open i would like to affilliate the nip from my customers textfile to the nip of my account textfile(which is :
C,D001,10001,457.98
C,C001,10021,1028.49
C,C002,10031,4.10
heere is my code so far (for this i use a console application)
static void Main(string[] args)
{
string strline;
string[] strarray;
char[] chararray=new char[]{','};
FileStream fs = new FileStream(@"I:\projet\ComptesCopy.txt", FileMode.Open);
StreamReader sr = new StreamReader(fs);
strline = sr.ReadLine();
while (strline!= null)
{
strarray = strline.Split(chararray);
for (int x = 0; x <= strarray.GetUpperBound(0); x++)
{
Console.WriteLine(strarray[x].Trim());
}
strline=sr.ReadLine();
}
sr.Close();
Console.ReadLine();
}
i can read all my content but i cant figure out how to proceed to match the nip from Uer textfile to nip from Account textfile
thanx by advance