Prev: Need Linq Help
Next: Communicating with a Unix server
From: Michel Racicot on 23 Apr 2010 17:17 I have a custom control derived from ComboBox that I need to load itself depending on one of its parameter. What event can I use for that? It doesn't seem to have a "OnLoad" event...
From: Jeff Johnson on 23 Apr 2010 17:36 "Michel Racicot" <mracicot(a)hotmail.com> wrote in message news:B6C4B10E-FFB9-41E7-AFA9-15101714BE79(a)microsoft.com... >I have a custom control derived from ComboBox that I need to load itself >depending on one of its parameter. > > What event can I use for that? It doesn't seem to have a "OnLoad" > event... Technicality: There is no OnLoad event. OnLoad is the name of a method. Load is the name of an event. Anyways, the way to do this is to handle it in the constructor for your custom control. This is, of course, assuming I understand what you meant by "load itself" correctly.
From: "Roger" rjpd AT NOnetzeroSPAM DOT on 23 Apr 2010 17:44 The DataSource property should be set by the caller to load the ComboBox with data. I think that is the right way. But if you have an overridden Constructor maybe the Load can be done there. Roger "Michel Racicot" <mracicot(a)hotmail.com> wrote in message news:B6C4B10E-FFB9-41E7-AFA9-15101714BE79(a)microsoft.com... >I have a custom control derived from ComboBox that I need to load itself >depending on one of its parameter. > > What event can I use for that? It doesn't seem to have a "OnLoad" > event...
From: Michel Racicot on 23 Apr 2010 18:10 The problem is that my custom property isn't set yet in the constructor.... I don't understand why... "Jeff Johnson" <i.get(a)enough.spam> wrote in message news:OmlrT0y4KHA.4264(a)TK2MSFTNGP02.phx.gbl... > "Michel Racicot" <mracicot(a)hotmail.com> wrote in message > news:B6C4B10E-FFB9-41E7-AFA9-15101714BE79(a)microsoft.com... > >>I have a custom control derived from ComboBox that I need to load itself >>depending on one of its parameter. >> >> What event can I use for that? It doesn't seem to have a "OnLoad" >> event... > > Technicality: There is no OnLoad event. OnLoad is the name of a method. > Load is the name of an event. > > Anyways, the way to do this is to handle it in the constructor for your > custom control. This is, of course, assuming I understand what you meant > by "load itself" correctly. >
From: Family Tree Mike on 23 Apr 2010 19:23
On 4/23/2010 6:10 PM, Michel Racicot wrote: > The problem is that my custom property isn't set yet in the > constructor.... I don't understand why... > Can you explain what that means? Do you mean that you need a property to be set "within" the constructor, so that you need a non-parameterless (if that is a word) constructor, something like below? I don't think this is possible for a control given that a user may drop it onto a form. public class MyComboBox : ComboBox { public string ConnectionString {get; set;} public MyComboBox (string connectionstring) { ConnectionString = connectionstring; // open a dataset, for example... } } -- Mike |