Part 2 : Search Data in Datagridview - Checkout this video -> kzbin.info/www/bejne/mpTWh62FgqqDjas
@vorapobautomation97603 ай бұрын
Dear Sir How to search Data in Datagridview if i use CSV file ?
@vorapobautomation97603 ай бұрын
How to Insert Update Delete data in Database from DataGridView ?
@vorapobautomation97603 ай бұрын
How to load Data From Notepad (.CSV) to DataGridView in C# Windows Form Application ?
@kadevtips3 ай бұрын
Hi, Please read my comment in the other comment thread. Thank you.
@vorapobautomation97603 ай бұрын
How to load Data From Notepad (.CSV) to DataGridView in C# Windows Form Application ?
@kadevtips3 ай бұрын
Hi there! You can try using the following code to load data from a CSV file into a DataGridView: private void btnLoadCSV_Click(object sender, EventArgs e) { string filePath = "path_to_your_csv_file.csv"; // Specify the path to your CSV file DataTable dataTable = LoadCSV(filePath); dataGridView1.DataSource = dataTable; } private DataTable LoadCSV(string filePath) { DataTable dt = new DataTable(); try { using (StreamReader sr = new StreamReader(filePath)) { string[] headers = sr.ReadLine().Split(','); // Reading headers foreach (string header in headers) { dt.Columns.Add(header); } while (!sr.EndOfStream) { string[] rows = sr.ReadLine().Split(','); DataRow dr = dt.NewRow(); for (int i = 0; i < headers.Length; i++) { dr[i] = rows[i]; } dt.Rows.Add(dr); } } } catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); } return dt; } Make sure to replace "path_to_your_csv_file.csv" with the actual path to your CSV file. This code will read the CSV file and display the data in a DataGridView. If you encounter any issues, feel free to ask for further help.