Developer studio woes
-
Hi, any pointers here would be highly appreciated. I'm refactoring part of a dialog box into a UserControl so that it can be used from another dialog. Nothing fancy there. My problem is that when the control loads, it populates its own sub-controls using data read from a database. The connection string for the database is read from the application's config file. This means that when you place the control from the toolbox onto another dialog, VS (2005 team edition) gives an error as it can't find the connection string (in its own config file!). I can work round this by adding all of the initialisation code into a function that is called by the control's container during construction. However, its not the easiest and cleanest interface to my control and I'm sure there must be a neater way of doing this that I'm just not spotting, e.g. a method override that's an appropriate place, or labelling the configuration method with a DevStudio attribute so that the configuration method doesnt get called? Maybe there's a better way of tackling the whole configuration problem? Anyway, thanks v. much for any help ou can give. Kev
-
Hi, any pointers here would be highly appreciated. I'm refactoring part of a dialog box into a UserControl so that it can be used from another dialog. Nothing fancy there. My problem is that when the control loads, it populates its own sub-controls using data read from a database. The connection string for the database is read from the application's config file. This means that when you place the control from the toolbox onto another dialog, VS (2005 team edition) gives an error as it can't find the connection string (in its own config file!). I can work round this by adding all of the initialisation code into a function that is called by the control's container during construction. However, its not the easiest and cleanest interface to my control and I'm sure there must be a neater way of doing this that I'm just not spotting, e.g. a method override that's an appropriate place, or labelling the configuration method with a DevStudio attribute so that the configuration method doesnt get called? Maybe there's a better way of tackling the whole configuration problem? Anyway, thanks v. much for any help ou can give. Kev
Hi, do you mean something like this?
if (!base.DesignMode) {
//initialize
}Robert
-
Hi, do you mean something like this?
if (!base.DesignMode) {
//initialize
}Robert