From: Michel Racicot on
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
"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
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
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
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
 |  Next  |  Last
Pages: 1 2
Prev: Need Linq Help
Next: Communicating with a Unix server