I am trying to get the string text out of a data grid view and store it in a data table so i can save the data table to a csv file. Problem is when I debug I notice the datatable stays null no matter what I do. I've tried everything. Does anyone know what
I might be doing wrong and how I can fix it? Could it be something is wrong in the data source. It's saying it's null in the debugger as well.
public frmSettings()
{
InitializeComponent();
lblMessage.Text = "Please create or open a setting file.";
_dt = (DataTable)gvSettings.DataSource;
}
private void mmuSaveAs_Click(object sender, EventArgs e)
{
Cursor = Cursors.WaitCursor;
saveFD.FileName = FileName;
//FD means File Dialog
saveFD.Title = "Save a CSV File as desired.";
saveFD.Filter = "CSV|*.csv";
saveFD.FileName = "default";
txtFilePath.Text = openFD.FileName;
if (saveFD.ShowDialog(this) == DialogResult.OK)
_dt = _objSetting.ProcessSettingFileCMD(saveFD.FileName);
}