private void Main_Load(object sender, EventArgs e) { Utils ut = new Utils(); ReadFromFile rd = new ReadFromFile(); DataTable dt = rd.ReadTxtToDataTable(path + "\\data.txt", 13); DataTable finalDT = rd.ConvertDataSet(dt); if (finalDT.Rows.Count == 0 || finalDT == null) { DataTable emptyDT = ut.CustomTable(); DataView view = new DataView(emptyDT); dataGridView1.DataSource = view; } else { DataView view = new DataView(finalDT); dataGridView1.DataSource = view; } }