Click here to Skip to main content
15,921,959 members
Home / Discussions / C#
   

C#

 
GeneralRe: instance does not exist in the current context Pin
Latheesan1-May-07 5:43
Latheesan1-May-07 5:43 
GeneralRe: instance does not exist in the current context Pin
Christian Graus1-May-07 10:40
protectorChristian Graus1-May-07 10:40 
AnswerRe: instance does not exist in the current context Pin
Latheesan1-May-07 6:03
Latheesan1-May-07 6:03 
QuestionWriting to a network drive - FileIOPermission Pin
andreshs130-Apr-07 17:09
andreshs130-Apr-07 17:09 
QuestionDesign Time Error, problems reading file Pin
Patricker30-Apr-07 16:12
Patricker30-Apr-07 16:12 
AnswerRe: Design Time Error, problems reading file Pin
Luc Pattyn30-Apr-07 23:28
sitebuilderLuc Pattyn30-Apr-07 23:28 
GeneralRe: Design Time Error, problems reading file Pin
Patricker30-Apr-07 23:58
Patricker30-Apr-07 23:58 
QuestionAccessing a method in the Main Form from a user control. Pin
CombatSheep30-Apr-07 15:39
CombatSheep30-Apr-07 15:39 
Hello.

I have a windows forms application (.NET 3.0)
where I have a user control ( a sort of spine) on a Form (called imaginatively enough MainForm).
In the spine I make a call to a WCF service (in a seperate thread). I need to be able to (from this seperate thread) to call a method (DisplayNotification) on the MainForm and pass it a parameter (or two).
I just can't seem to do this. I am however able (with delegates) to do this with methods/controls on the spine. But unfortunate not the MainForm.
Can someone give me a leg up on this?

Basically:

Spine(usercontrol on MainForm) ->starts thread(WCF service) ->needs to access DisplayNotification() on MainForm.

I tried using FindContol() and even .Parent but I am embarassed to say...
I don't know how to use it. I can get a list of controls that match the control I want. I get it in a the form of ArrayOfFormControls[]. It's just that I don't know how to invoke properties on the say ArrayOfFormControls[0].

Can you point me towards an example? Basically I would prefer to use a METHOD in the MainForm to do my dirty work, rather than use properties on the control itself.

Some have mentioned using reflection, I'm afraid I have no experience with using reflection. Can you point towards an example or tutorial. I have googled it, and come up short....

There has also been talk of passing a reference to the mainform in the constructor of my usercontrol. Any concrete examples?

Thanks!




----------------------------------------
Code is sexy. Go get some.
AnswerRe: Accessing a method in the Main Form from a user control. Pin
Arun.Immanuel30-Apr-07 16:01
Arun.Immanuel30-Apr-07 16:01 
QuestionChanging the connection string of a typed dataset programatically Pin
Rocky#30-Apr-07 15:15
Rocky#30-Apr-07 15:15 
Questionform's opacity Pin
adel_soli30-Apr-07 14:35
adel_soli30-Apr-07 14:35 
AnswerRe: form's opacity Pin
Christian Graus30-Apr-07 14:47
protectorChristian Graus30-Apr-07 14:47 
GeneralRe: form's opacity Pin
adel_soli1-May-07 1:30
adel_soli1-May-07 1:30 
GeneralRe: form's opacity Pin
Christian Graus1-May-07 1:49
protectorChristian Graus1-May-07 1:49 
GeneralRe: form's opacity Pin
adel_soli1-May-07 2:40
adel_soli1-May-07 2:40 
GeneralRe: form's opacity Pin
PIEBALDconsult3-May-07 9:11
mvePIEBALDconsult3-May-07 9:11 
GeneralRe: form's opacity Pin
PIEBALDconsult3-May-07 9:16
mvePIEBALDconsult3-May-07 9:16 
QuestionExporting to Excel using C# and Visual Studio 2005 Pin
laura131630-Apr-07 14:24
laura131630-Apr-07 14:24 
Questionimportanat Pin
hazem maher30-Apr-07 14:17
hazem maher30-Apr-07 14:17 
AnswerRe: importanat Pin
adel_soli30-Apr-07 14:44
adel_soli30-Apr-07 14:44 
AnswerRe: importanat Pin
Christian Graus30-Apr-07 14:47
protectorChristian Graus30-Apr-07 14:47 
QuestionSimple math dividing Pin
laura131630-Apr-07 11:01
laura131630-Apr-07 11:01 
AnswerRe: Simple math dividing Pin
led mike30-Apr-07 11:07
led mike30-Apr-07 11:07 
AnswerRe: Simple math dividing Pin
Luc Pattyn30-Apr-07 14:57
sitebuilderLuc Pattyn30-Apr-07 14:57 
AnswerRe: Simple math dividing Pin
Arun.Immanuel30-Apr-07 15:31
Arun.Immanuel30-Apr-07 15:31 

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.