How is a method added to a control in a Windows form using C# project?

Are you preparing for IT certification? With practice questions, study notes, interactive quizzes, tips and technical articles, uCertify PrepKits ensure that you get a solid grasp of core technical concepts to ace your certification exam in first attempt.

How is a method added to a control in a Windows form using C# project?

Rating:

In a Windows form, a method is added to a control in the same way as it is added to a form or a class. In the Code window of the form, a method declaration and a method body is added within the bounds of the class declaration. A method can be added to a control in two ways. A void method is created when a method does not return a value. For example:

public void AddString(string MyString1, string MyString2)
{
   string str = MyString1 + MyString1;
   MessageBox.Show(str);
}


A return type method is specified when a method returns a value. For example:

public string AddString(string MyString1, string MyString2)
{
    string str = MyString1 + MyString1;
    return str;
}


Rating:



Other articles

Click here to Article home

Microsoft Certification MCSE: MCSA , MCTS, MCDST, MCAD, MCDBA, MCSE Messaging, MCSE Security
JAVA Certification: SCJP, SCWCD Cisco Certification: CCNA, CCENT, A+, Network+, Security+
Oracle Certification: OCP 9i, OCP 10g, OCA 9i, OCA 10g CIW foundation    EC-212-32    CISSP    Photoshop ACE    Adobe Flash ACE
© 2008 uCertify.com. All rights reserved. All trademarks are the property of their respective owners.
 
HACKER SAFE certified sites prevent over 99.9% of hacker crime.