Hi all,
I need some help here,
The data in textbox looks like this:
M/z= 151.874862, P= 32.624691%, Rel. Int.= 78.220479%
M/z= 152.878217, P= 0.352860%, Rel. Int.= 0.846011%
M/z= 153.871912, P= 41.708632%, Rel. Int.= 100.000000%
M/z= 154.875267, P= 0.451109%, Rel. Int.= 1.081573%
M/z= 155.868962, P= 19.995706%, Rel. Int.= 47.941409%
M/z= 156.872317, P= 0.216268%, Rel. Int.= 0.518521%
M/z= 157.866012, P= 4.260544%, Rel. Int.= 10.215017%
M/z= 158.869367, P= 0.046081%, Rel. Int.= 0.110483%
M/z= 159.863062, P= 0.340427%, Rel. Int.= 0.816204%
I want to separate all the values (numerical values) of M/z into a textbox and values (numerical values) of Rel. Int. into another textbox.
I wrote a code like this as I'm in the initial stage of C#
foreach(string line in richTextBox1.Lines)
{
for (int i = 0; i < line.Length; i++)
{
if(((line[i]>='A') && (line[i]<='Z')) || ((line[i]>='a') && (line[i]<='z')) || (line[i] == '='))
{
textBox23.AppendText(line[i].ToString());
}
else if (((line[i] >= '0') && (line[i] <= '9')) || (line[i] == '.'))
{
textBox24.AppendText(line[i].ToString());
}
if (line[i] == ',')
{
textBox24.AppendText(Environment.NewLine);
}
}
textBox24.AppendText(Environment.NewLine);
}
foreach (string lines in textBox24.Lines)
{
for (int i = 0; i < lines.Length; i++)
{
if (((lines[i] >= '0') && (lines[i] <= '9')) || (lines[i] == '.'))
{
textBox25.AppendText(lines[i].ToString());
}
if (lines[i] == '.' && lines[i+1] == '.')
{
textBox24.AppendText(Environment.NewLine);
}
}
But there are some errors here and the values are not separated into two textboxes here.
Please help me out.