G
Guest
Hi I have the following method that I'm having trouble with. The method
should check that the files exist. If it does, then dynamically create a
checkbox for that file. Not sure if the second array databasesActual is
required which is where I'm geeting mixed up.
private void AddCheckBoxes(string dbFolder)
{
string[] databases = {"C:\Master.mdb", "C:\Toolbox.mdb", "C:\Import.mdb",
"C:\Library.mde", "C:\User.mdb", "C:\ImpData.mdb"};
string[] databasesActual;
for ( int j = 0; j < databases.Length; j++ )
{
if ( File.Exists(dbFolder + databases[j] ))
databasesActual = databases[j].ToString();
this.checkBoxes = new CheckBox[databases.Length];
int x = 68, y = 8;
for(int i = 0; i < this.checkBoxes.Length; i++)
{
CheckBox checkBox = new CheckBox();
checkBox.Parent = this;
checkBox.Location = new Point(x,y);
y += 32;
checkBox.Size = new Size(161, 21);
checkBox.Text = databases.ToString();
this.checkBoxes = checkBox;
}
}
should check that the files exist. If it does, then dynamically create a
checkbox for that file. Not sure if the second array databasesActual is
required which is where I'm geeting mixed up.
private void AddCheckBoxes(string dbFolder)
{
string[] databases = {"C:\Master.mdb", "C:\Toolbox.mdb", "C:\Import.mdb",
"C:\Library.mde", "C:\User.mdb", "C:\ImpData.mdb"};
string[] databasesActual;
for ( int j = 0; j < databases.Length; j++ )
{
if ( File.Exists(dbFolder + databases[j] ))
databasesActual = databases[j].ToString();
this.checkBoxes = new CheckBox[databases.Length];
int x = 68, y = 8;
for(int i = 0; i < this.checkBoxes.Length; i++)
{
CheckBox checkBox = new CheckBox();
checkBox.Parent = this;
checkBox.Location = new Point(x,y);
y += 32;
checkBox.Size = new Size(161, 21);
checkBox.Text = databases.ToString();
this.checkBoxes = checkBox;
}
}