i have a CSV file which doesnt have commas it opens like an excel file.
i want to have a windows form with a textbox,once i enter a number in the textbox it must correspond to the number in the csv file nad print that row only.
for expamle this is my csv file with no headings
|
A |
B |
C |
1 |
5 |
test |
9 |
2 |
2 |
test |
88 |
3 |
44 |
frerg |
47 |
if i enter 1 in my textbox it must fetch me the details for that row only and it must get printed.
what i tried
private void btnPrint_Click(object sender, EventArgs e)
{
string currentLine = string.Empty;
bool isFound = false;
int count = 0;
using (StreamReader file = new StreamReader(path))
{
while ((currentLine = file.ReadLine()) != null && !isFound)
{
count++;
if (count == Convert.ToInt32( txtRowNumber.Text))
{
string[] totalData = new string[File.ReadAllLines(path).Length];
Console.WriteLine(txtRowNumber.Text);
count = 0;
isFound = true;
}
}
}