Computer Science Canada Help with Visual C# Combo Boxes |
Author: | Kyle Biro [ Wed Dec 11, 2013 10:49 pm ] | ||||
Post subject: | Help with Visual C# Combo Boxes | ||||
I've created a combo box and I'm trying to add all the installed fonts to it but nothing shows up when I run the program. I also have another combo box that should add the numbers 10 to 75 to represent font sizes. I'm fairly new to C# and I'm just stuck with this. Also, please forgive any formatting mistakes I make as I'm new to the forums. Any help would be appreciated. How I attempt to get the fonts and add them to the combo box.
How I try to add the numbers to the combo box
I do have a method that calls InstalledFonts() and FontSize() when the program loads. |
Author: | rdrake [ Thu Dec 12, 2013 11:19 am ] | ||||||||
Post subject: | Re: Help with Visual C# Combo Boxes | ||||||||
I no longer have a Windows machine and thus no access to VS, but I can hopefully point you in the right direction... Kyle Biro @ Wed Dec 11, 2013 10:49 pm wrote: I've created a combo box and I'm trying to add all the installed fonts to it but nothing shows up when I run the program. What do you mean by "nothing shows up"? Does it add anything to the combo box? Are you able to see a number of blank spaces where the text should be? A picture may be helpful.
I would make use of foreach, rather than for. In this following case you are starting the index at 1 rather than 0.
I would do the following, avoiding the loop entirely:
Edit: Oh, forgot to mention. The great thing about using DataSource is you can do something like this to get the FontFamily object back from the list.
|