473,320 Members | 1,881 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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
Nov 15 '05 #1
2 1715
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" <no****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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

Nov 15 '05 #2
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]" <er****@online.microsoft.com> wrote in message
news:es**************@TK2MSFTNGP09.phx.gbl...
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" <no****@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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


Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Nima | last post by:
The documentation for the Delegate and the MultiCastDelegate classes tell me that when we have a line like: public delegate void CheckAndPrintDelegate(string str); it causes the compiler to...
1
by: CJ Taylor | last post by:
Alright, I probably wont be able to get this question answered, but maybe someone has even more experience than me with delegates... Wow... that sounded fecisious. =) So, I'm trying to...
2
by: sg71.cherub | last post by:
Here I am meeting a problem. I am transfering unmanaged C/C++ codes to managed C# codes. For the general C/C++ function pointer, it is easy to implement its function by C# delegate. e.g. Declare...
1
by: Quimbly | last post by:
I'm having some problems comparing delegates. In all sample projects I create, I can't get the problem to occur, but there is definitely a problem with my production code. I can't give all the...
3
by: Peter Duniho | last post by:
I was reminded in a recent post (http://groups.google.com/group/microsoft.public.dotnet.framework/msg/e649e992db857691?dmode=source) that in C# one can use anonymous delegates without...
4
by: Bob Cramer | last post by:
I don't have a copy of Reflector handy :-( so I'd appreciate if someone could confirm (or clarify) the following. In consideration of the following delegate declaration... delegate string...
2
by: Tony Johansson | last post by:
Hello!! Below is a program copied from a book. The program is easy but there is one thing about the program that I would like to have some more info about. Assume that you have for example 10...
6
by: damiensawyer | last post by:
Hi, Can someone please explain to me something about delegates? My understanding is as follows. A delegate is basically an object that can hold a reference to a "method" somewhere. That is,...
8
by: Advait Mohan Raut | last post by:
Hello, I am using VC# 2005 ; C# 2.0 I am working on the performance measurement tool. For that I need my code to call user defined method along with its parameters. For that should I use a...
3
by: puzzlecracker | last post by:
Sort of new to internal of delegates. My question is when you create a delegate instance, does the surrounding block must be able to see/access method you want delegate to take on. Here is...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.