Gladimir
Regular
I have created the public class fileInfo with two properties; 1) PathName and 2) FileName.
I have two buttons on form Main, buttonSetFile and buttonTable. The click event for buttonSetFile allows the end-user to select a database file using openFileDialog1 (see code below).
I want to read the PathName and the FileName from the buttonSetFile click event in the buttonTable click event. In fact, I want to pass the PathName and FileName values to a new form made available to the end-user in the buttonTable click event.
How/Where do I instantiate a fileInfo object to make the PathName and FileName properties available from all control events or even from another form?
I have two buttons on form Main, buttonSetFile and buttonTable. The click event for buttonSetFile allows the end-user to select a database file using openFileDialog1 (see code below).
C#:
private void buttonSetFile_Click(object sender, System.EventArgs e)
{
switch (openFileDialog1.ShowDialog())
{
case DialogResult.OK:
fileInfo dbInfo = new fileInfo();
dbInfo.PathName = openFileDialog1.FileName;
labelDatabaseName.Text = dbInfo.FileName;
buttonTable.Enabled = true;
break;
case DialogResult.Cancel:
break;
}
}
I want to read the PathName and the FileName from the buttonSetFile click event in the buttonTable click event. In fact, I want to pass the PathName and FileName values to a new form made available to the end-user in the buttonTable click event.
How/Where do I instantiate a fileInfo object to make the PathName and FileName properties available from all control events or even from another form?