Click here to Skip to main content
15,894,460 members
Home / Discussions / C#
   

C#

 
GeneralRe: Writing to Excel without installation of MS Excel Pin
Priya Prk18-Jan-10 1:03
Priya Prk18-Jan-10 1:03 
GeneralRe: Writing to Excel without installation of MS Excel Pin
OriginalGriff18-Jan-10 1:37
mveOriginalGriff18-Jan-10 1:37 
AnswerRe: Writing to Excel without installation of MS Excel Pin
Dan Mos18-Jan-10 7:39
Dan Mos18-Jan-10 7:39 
AnswerRe: Writing to Excel without installation of MS Excel Pin
DaveyM6918-Jan-10 12:25
professionalDaveyM6918-Jan-10 12:25 
QuestionError while sending mail using System.Net.Mail in C# Pin
WinCrs17-Jan-10 23:09
WinCrs17-Jan-10 23:09 
AnswerRe: Error while sending mail using System.Net.Mail in C# Pin
Md. Marufuzzaman18-Jan-10 3:46
professionalMd. Marufuzzaman18-Jan-10 3:46 
QuestionEnable button on form1 while inside form2 Pin
tonyonlinux17-Jan-10 22:35
tonyonlinux17-Jan-10 22:35 
AnswerRe: Enable button on form1 while inside form2 Pin
OriginalGriff17-Jan-10 23:20
mveOriginalGriff17-Jan-10 23:20 
The reason is simple: the default access specifiers for controls is not public, so that stuff like this won;t work.
Why not? Because it is very bad practice. It ties the design of the two forms together, so that both must change if one does.

A better idea is to create an event in form two which form one subscribes to. Form two then "throws" the event so say "Changed", and form one handles the implementation.

I.e. Form one knows it has a button, so it handles all thing to do with it, including enable / disable. Form two just knows that the user has done something which form on knows how to handle.

Events aren't difficult to implement:
In form two:

public event EventHandler Changed;

protected virtual void OnChanged(EventArgs e)
   {
   EventHandler eh = Changed;
   if (eh != null)
      {
      eh(this, e);
      }
   }

private void DoSomethingToChangeData()
   {
   OnChanged(null);
   }


In form one:

frmChild.Change += new frmChange.ChangeHandler(Changed);

private void Changed(object sender, EventArgs e)
    {
    }


All those who believe in psycho kinesis, raise my hand.

AnswerRe: Enable button on form1 while inside form2 Pin
dan!sh 17-Jan-10 23:22
professional dan!sh 17-Jan-10 23:22 
AnswerRe: Enable button on form1 while inside form2 Pin
April Fans18-Jan-10 15:25
April Fans18-Jan-10 15:25 
GeneralRe: Enable button on form1 while inside form2 Pin
tonyonlinux18-Jan-10 17:24
tonyonlinux18-Jan-10 17:24 
QuestionHow can i find all open / active windows ? Pin
Yanshof17-Jan-10 22:22
Yanshof17-Jan-10 22:22 
AnswerRe: How can i find all open / active windows ? Pin
dan!sh 17-Jan-10 23:18
professional dan!sh 17-Jan-10 23:18 
AnswerRe: How can i find all open / active windows ? Pin
April Fans18-Jan-10 15:27
April Fans18-Jan-10 15:27 
QuestionIs it a Bug ? Pin
Xmen Real 17-Jan-10 22:15
professional Xmen Real 17-Jan-10 22:15 
AnswerRe: Is it a Bug ? Pin
dan!sh 17-Jan-10 22:26
professional dan!sh 17-Jan-10 22:26 
GeneralRe: Is it a Bug ? Pin
Xmen Real 17-Jan-10 23:16
professional Xmen Real 17-Jan-10 23:16 
GeneralRe: Is it a Bug ? Pin
#realJSOP18-Jan-10 0:01
mve#realJSOP18-Jan-10 0:01 
AnswerRe: Is it a Bug ? Pin
OriginalGriff17-Jan-10 23:27
mveOriginalGriff17-Jan-10 23:27 
Questionmynamespace.App app = new mynamespace.App() Pin
V.17-Jan-10 21:42
professionalV.17-Jan-10 21:42 
AnswerRe: mynamespace.App app = new mynamespace.App() Pin
Abhinav S17-Jan-10 22:37
Abhinav S17-Jan-10 22:37 
GeneralRe: mynamespace.App app = new mynamespace.App() Pin
V.18-Jan-10 19:48
professionalV.18-Jan-10 19:48 
Questionc# string operation Pin
AndieDu17-Jan-10 18:14
AndieDu17-Jan-10 18:14 
AnswerRe: c# string operation Pin
Sagar Khairnar 5517-Jan-10 19:04
professionalSagar Khairnar 5517-Jan-10 19:04 
AnswerRe: c# string operation Pin
PIEBALDconsult17-Jan-10 19:05
mvePIEBALDconsult17-Jan-10 19:05 

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.