473,387 Members | 1,528 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,387 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 1719
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.