Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create a method that accepts one string and outputs another...

Status
Not open for further replies.

arachnoid

Programmer
Jun 14, 2002
108
US
I am attempting to learn C# via a book and I am looking for examples of code that will allow me to create a method as part of a form that accepts one string and outputs a different string.

I need to accomplish this by adding code to the TextChanged event of a text box to call the procedure, passing the contents of the text box as the argument.

I know this must be very simple; however, I am at a loss. Any help would be appreciated.

Regards,
 
Here's a sample method that can be called from within your form (but not outside of it, as it's private) that accepts a string and returns the upper-case of that string. You would call it from your TextChanged event, passing the .Text property of your textbox to it.
Code:
public class Form1 : System.Windows.Forms.Form
{
  private string MyMethod(string InParameter)
  {
    return InParameter.ToUpper();
  }
}
Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top