C#NET2008 Upper case and Lower case Character

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lenniekuah
    New Member
    • Oct 2006
    • 126

    C#NET2008 Upper case and Lower case Character

    Hullo Awesome Helpers,
    Thank you for helping me earlier.
    I am back with new problem. I am trying to covert a TEXT String into either Lower and Upper case characterS. (Upper case Eg. ALFRED instead of alfred)
    (Lower case Eg. thompson instead of THOMPSON )

    Please help me.

    Coding
    //convert to lower case
    string strName = lcase(this.txtN ame.text) <-- not working

    //convert country to Upper case
    string strCountry =ucase(this.tex tCountry.text)<-not work

    Thank you for your help.

    Cheers,
    Lennie
  • GaryTexmo
    Recognized Expert Top Contributor
    • Jul 2009
    • 1501

    #2


    Have a look there. The ToUpper and ToLower methods on a string are what you're looking for. The MSDN reference is great for people just learning the framework, just do a search on the object you're using :)

    Comment

    • lenniekuah
      New Member
      • Oct 2006
      • 126

      #3
      After view the MSDN Website
      I convert this coding that I posted earlier to this structure;

      //convert country to Upper case
      string strCountry = Uppercase(this. textCountry.tex t)

      And it generates this error message:

      Error 1 The name 'Uppercase' does not exist in the current context

      Comment

      • GaryTexmo
        Recognized Expert Top Contributor
        • Jul 2009
        • 1501

        #4
        Please review both my post and the MSDN article. I'm not sure how you got Uppercase as a viable method to call, the error message is pretty clear here.

        The link is a list of methods available on the string class, you'll want the ones that convert to upper or lower case. Read the link, find the appropriate method, and click it's name. You'll find a code example there.

        Comment

        • Rohit Garg
          New Member
          • Jul 2010
          • 8

          #5
          You have to use it in the following way
          Code:
          string strCountry = this.textBox1.Text.ToUpper();
          and for lowercase
          Code:
          string strCountry = this.textBox1.Text.ToLower();

          Comment

          • lenniekuah
            New Member
            • Oct 2006
            • 126

            #6
            Hullo Robit
            Thank you for sharing the sample coding with me. That is awesomea and my coding is working how.

            You are wonderful and generous in sharing your knowledge with me. I have learned somehthing new from you. thank you very much

            Comment

            • NeoPa
              Recognized Expert Moderator MVP
              • Oct 2006
              • 32663

              #7
              Sorry Rohit.

              I've reset the Best Answer in this case as it is simply a repeat of what had already been stated in an earlier reply.

              I have no idea why Lennie chose to assign yours in place of the earlier, perfectly good, reply, but that is not what the feature is for.

              This is in no way a criicism of your post - simply that post #2 was at least as good and already posted. It may not have been an abuse, but it was certainly illogical.

              Comment

              Working...