Delegate Question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John

    #1

    Delegate Question

    I have a form with a bunch of combo boxes that will be populated at runtime
    based on user input. I have created a class for the form with will handle
    all of the UI processes. I am trying to create a generic delegate that will
    handle all of the combo box loads. So, when the form invokes the UI process
    class to load the combo box it will call the write method to load the combo
    box on the form. How do I do this? Do I need to create an event for each
    combo box? Any ideas?

    Thanks


  • Eric Gunnerson [MS]

    #2
    Re: Delegate Question

    When your event gets called, the "sender" parameter will be the combobox
    that the event is for, so you should be able to cast that to ComboBox in
    your routine, and then fill it.

    You'll also need to hook up the event on each combo box to point to this
    routine

    Hope that helps.

    --
    Eric Gunnerson

    Visit the C# product team at http://www.csharp.net
    Eric's blog is at http://blogs.gotdotnet.com/ericgu/

    This posting is provided "AS IS" with no warranties, and confers no rights.
    "John" <nospam@hotmail .com> wrote in message
    news:%23qvFbvpj DHA.2424@TK2MSF TNGP10.phx.gbl. ..[color=blue]
    > I have a form with a bunch of combo boxes that will be populated at[/color]
    runtime[color=blue]
    > based on user input. I have created a class for the form with will handle
    > all of the UI processes. I am trying to create a generic delegate that[/color]
    will[color=blue]
    > handle all of the combo box loads. So, when the form invokes the UI[/color]
    process[color=blue]
    > class to load the combo box it will call the write method to load the[/color]
    combo[color=blue]
    > box on the form. How do I do this? Do I need to create an event for each
    > combo box? Any ideas?
    >
    > Thanks
    >
    >[/color]


    Comment

    • Darin

      #3
      Re: Delegate Question

      Thanks for the response. Right now I have a generic delegate with events
      for each combo box. Is see how I could do it the way you describe. Which
      way is right/ best design?

      Thanks

      "Eric Gunnerson [MS]" <ericgu@online. microsoft.com> wrote in message
      news:es1BJX2jDH A.1884@TK2MSFTN GP09.phx.gbl...[color=blue]
      > When your event gets called, the "sender" parameter will be the combobox
      > that the event is for, so you should be able to cast that to ComboBox in
      > your routine, and then fill it.
      >
      > You'll also need to hook up the event on each combo box to point to this
      > routine
      >
      > Hope that helps.
      >
      > --
      > Eric Gunnerson
      >
      > Visit the C# product team at http://www.csharp.net
      > Eric's blog is at http://blogs.gotdotnet.com/ericgu/
      >
      > This posting is provided "AS IS" with no warranties, and confers no[/color]
      rights.[color=blue]
      > "John" <nospam@hotmail .com> wrote in message
      > news:%23qvFbvpj DHA.2424@TK2MSF TNGP10.phx.gbl. ..[color=green]
      > > I have a form with a bunch of combo boxes that will be populated at[/color]
      > runtime[color=green]
      > > based on user input. I have created a class for the form with will[/color][/color]
      handle[color=blue][color=green]
      > > all of the UI processes. I am trying to create a generic delegate that[/color]
      > will[color=green]
      > > handle all of the combo box loads. So, when the form invokes the UI[/color]
      > process[color=green]
      > > class to load the combo box it will call the write method to load the[/color]
      > combo[color=green]
      > > box on the form. How do I do this? Do I need to create an event for[/color][/color]
      each[color=blue][color=green]
      > > combo box? Any ideas?
      > >
      > > Thanks
      > >
      > >[/color]
      >
      >[/color]


      Comment

      Working...