Extending ComboBox class, need to add my own items but when??

  • Thread starter Thread starter 0to60
  • Start date Start date
0

0to60

I'm extending the ComboBox class to create a combo for entering times like
in Outlook 2007. I'd like the combo to drop down and let the user select
from different times. I would like to set the interval for these times in
my app.config file though, which means I'll need to read in the interval
value before I load the items. Initially, I put the code that does this in
the constructor, but then when I tried to add the control to a form in the
designer, VS puked (because its trying to execute code to read the config
file; I guess you can't do this at design time). So, where do I put this
code? I don't wanna put it in OnPaint, because I only need it to go off
once. Where do I put this code so that it only goes off once?
 
I'm extending the ComboBox class to create a combo for entering times like
in Outlook 2007. I'd like the combo to drop down and let the user select
from different times. I would like to set the interval for these times in
my app.config file though, which means I'll need to read in the interval
value before I load the items. Initially, I put the code that does this
in the constructor, but then when I tried to add the control to a form in
the designer, VS puked (because its trying to execute code to read the
config file; I guess you can't do this at design time). So, where do I
put this code? I don't wanna put it in OnPaint, because I only need it to
go off once. Where do I put this code so that it only goes off once?

I always have an Initialise function:

public class jclass()
{
InitializeComponents();
if(!this.DesignMode)
jclassInitialise();
}

private void jclassInitialise()
{
// set stuff up here
}
 
Back
Top