I am quite new to programming and I am usually learning from courses on YouTube or directly tutorials from Youtube. My problem is I want to load file from CSV file and then update the loaded file into DataGridView. But to do so I was following a tutorial but I dunno what table to use.
private void btnOtvor_Click(object sender, EventArgs e)
{
try
{
using (OpenFileDialog ofd = new OpenFileDialog() { Filter = "CSV|*.csv", ValidateNames = true, Multiselect = false })
{
if (ofd.ShowDialog() == DialogResult.OK)
dataGridViewZamestnanci.DataSource = Readcsv(ofd.FileName);
labelErrMsg.Text = "Subor otvoreny spravne";
labelErrMsg.ForeColor = System.Drawing.Color.Green;
timer1.Start();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
But when I am creating the ADD button:
private void btnPridat_Click(object sender, EventArgs e)
{
dataGridViewZamestnanci.Rows.Add(textBoxMeno.Text, textBoxTel.Text, textBoxProfesia.Text, textBoxTpp.Text);
dataGridViewZamestnanci.DataSource = dataGridViewZamestnanci;
it doesnt see the DatagridviewZamestnanci, there should be datatable but since I loaded it from CSV file directly I am confused and honestly lost...
Can somebody help me, please ?