Click here to Skip to main content
15,905,781 members
Home / Discussions / C#
   

C#

 
QuestionIMAP Pin
kathiresanmoorthy18-Aug-08 20:56
kathiresanmoorthy18-Aug-08 20:56 
Questionclickonce setup - publish Pin
arkiboys18-Aug-08 20:52
arkiboys18-Aug-08 20:52 
AnswerRe: clickonce setup - publish Pin
AhsanS18-Aug-08 20:56
AhsanS18-Aug-08 20:56 
QuestionHelp!!!! Pin
Grim Re@p3r18-Aug-08 20:30
Grim Re@p3r18-Aug-08 20:30 
AnswerRe: Help!!!! Unclear post Pin
Muhammad Gouda18-Aug-08 21:18
Muhammad Gouda18-Aug-08 21:18 
QuestionMDI children instances, how to code Pin
ianhunt0118-Aug-08 20:12
ianhunt0118-Aug-08 20:12 
AnswerRe: MDI children instances, how to code Pin
AhsanS18-Aug-08 20:33
AhsanS18-Aug-08 20:33 
AnswerRe: MDI children instances, how to code Pin
DaveyM6918-Aug-08 22:52
professionalDaveyM6918-Aug-08 22:52 
The problem with this approach is the MdiChildren property of the parent is an array of forms so you can only see the standard properties and methods of the Form class unless you cast each member of the array to the appropriate class. That can be done by the code below.

Assuming you have a class ChildForm1 : Form with a method DoSomething and property SomeProperty.
foreach (Form child in this.MdiChildren)
{
   if (child is ChildForm1)
   {
      ChildForm1 theChild = (ChildForm1)child;
      MessageBox.Show(theChild.SomeProperty);
      theChild.DoSomething();
   }
}
This is going to get messy if you have many forms with many properties and methods and will difficult to maintain.

You could use reflection to get all the info about the child forms and their methods/properties but that may be a little slow depending on just how much reflection you need to do, but is probably the best solution here.

Have you thought about creating an interface that your all child forms can implement as well as deriving form Form? You could add all the properties and methods that will be available in the children to the interface and implement them on the appropriate forms. The ones that shouldn't implement a specific property or method could throw a NotImplementedException so you know it's not available.

Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)
Expect everything to be hard and then enjoy the things that come easy. (code-frog)

AnswerRe: MDI children instances, how to code Pin
ianhunt0119-Aug-08 8:56
ianhunt0119-Aug-08 8:56 
GeneralRe: MDI children instances, how to code Pin
DaveyM6919-Aug-08 11:10
professionalDaveyM6919-Aug-08 11:10 
QuestionHow to bind hardcoded DataGridView with DataTable Pin
Piyush Vaishnav18-Aug-08 19:24
Piyush Vaishnav18-Aug-08 19:24 
AnswerRe: How to bind hardcoded DataGridView with DataTable Pin
AhsanS18-Aug-08 19:33
AhsanS18-Aug-08 19:33 
Questionsource code of scannig image from web cam in vb.net or in c# Pin
shp_ptn18-Aug-08 19:02
shp_ptn18-Aug-08 19:02 
AnswerRe: source code of scannig image from web cam in vb.net or in c# Pin
AhsanS18-Aug-08 19:24
AhsanS18-Aug-08 19:24 
QuestionLinq Noob, stuck on type inference... Pin
callingshotgun18-Aug-08 18:54
callingshotgun18-Aug-08 18:54 
AnswerRe: Linq Noob, stuck on type inference... Pin
leppie18-Aug-08 22:14
leppie18-Aug-08 22:14 
GeneralRe: Linq Noob, stuck on type inference... Pin
callingshotgun19-Aug-08 5:06
callingshotgun19-Aug-08 5:06 
GeneralRe: Linq Noob, stuck on type inference... Pin
leppie19-Aug-08 5:47
leppie19-Aug-08 5:47 
GeneralRe: Linq Noob, stuck on type inference... Pin
callingshotgun19-Aug-08 6:06
callingshotgun19-Aug-08 6:06 
QuestionPInvoke Heartburn Pin
ahfong18-Aug-08 14:33
ahfong18-Aug-08 14:33 
AnswerRe: PInvoke Heartburn Pin
leppie18-Aug-08 22:08
leppie18-Aug-08 22:08 
QuestionShould GenericQueue.Enqueue work while a different thread has LOCK(GenericQueue) ? Pin
JoeRip18-Aug-08 11:46
JoeRip18-Aug-08 11:46 
AnswerRe: Should GenericQueue.Enqueue work while a different thread has LOCK(GenericQueue) ? Pin
Colin Angus Mackay18-Aug-08 12:41
Colin Angus Mackay18-Aug-08 12:41 
GeneralRe: Should GenericQueue.Enqueue work while a different thread has LOCK(GenericQueue) ? Pin
JoeRip18-Aug-08 14:19
JoeRip18-Aug-08 14:19 
GeneralRe: Should GenericQueue.Enqueue work while a different thread has LOCK(GenericQueue) ? Pin
Colin Angus Mackay18-Aug-08 21:06
Colin Angus Mackay18-Aug-08 21:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.