I am having an issue with graphical corruption upon re-selecting a
combobox which upon 'selected index change' event should list file
names in that folder in a separate combobox. Here is the code:
private void comboBox2_Selec tedIndexChanged (object sender, EventArgs e)
{
IniFile INI = new IniFile(@"c:\\d ata\TM.ini");
string MisFileDir = INI.IniReadValu e("Main", "MisFileDir ");
//MessageBox.Show (MisFileDir + @"\" + this.comboBox2. Text +
@"\");
DirectoryInfo dir = new DirectoryInfo(M isFileDir + @"\" +
this.comboBox2. Text + @"\");
FileInfo[] misfiles = dir.GetFiles();
comboBox1.Items .Clear();
comboBox1.Begin Update();
foreach (FileInfo f in misfiles)
{
comboBox1.Items .Add(f.Name);
}
comboBox1.Updat e();
}
As you can see, I'm using an INI file class that utilizes a
kernel32.dll function to read from the INI. (see this article -
http://www.codeproject.com/csharp/cs...&select=359787)
This part works perfectly well. And upon the first selection of
comboBox2 , comboBox1 usually updates fine with a list of files in the
given folder.
The problem comes primarily when I select a different index in
comboBox2, the comboBox1 imagery corrupts. I can still see the indexes,
but the text of that comboBox is invisible or garbled. [yes i should
have used the opposite numbers for their names! sorry for confusion:)]
Question:
My question is, am I updating the comboBox1 items in the appropriate
order? What is the best way to clear a combobox and re-add items to it?
Here is an image of the corruption:
http://seow.trianglesimsociety.org/corruptedimage.JPG
Thanks for any suggestions you may be able to provide.
MurdockSE