Hi Jez,
You need some way of knowing which of the databases exist, but since you
don't know how many an ArrayList is better than an Array, so your code
would be something like this:
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"};
ArrayList databasesFound = new ArrayList();
foreach(string s in databases)
if(File.Exists(dbFolder + s)
databasesFound.Add(s);
this.checkBoxes = new CheckBox[databasesFound.Count];
for(int i = 0, x = 68, y = 8; i < this.checkBoxes.Length; i++, y += 32

{
CheckBox checkBox = new CheckBox();
checkBox.Parent = this;
checkBox.Location = new Point(x,y);
checkBox.Size = new Size(161, 21);
checkBox.Text = databasesFound[i].ToString();
this.checkBoxes[i] = checkBox;
}
}
Ignore the other changes if you want, they are just to show you a
different way of doing the same.
--
Happy Coding!
Morten Wennevik [C# MVP]