CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 2011
    Posts
    1

    Strings in Texboxes

    Hello all, I'm just starting C# so I'm still in the noobie phase of this one. I have basic C++ knowledge but I'm doing a special project for work so I was hoping I could pound out a pretty quick and easy program using C#.

    I'm essentially trying to have a bunch of different textboxes, comboboxes, and check boxes for the end user to input, have them all converted to strings and display in a preview (un-editable) text box. Ultimately the user can copy everything in this box but I haven't gotten to that stage yet.

    I'm pretty sure what I'm trying to do is extremely basic and I'm more than likely overthinking it but I was hoping someone may be able to shed some light on what I should be doing here. I can't seem to find any youtube videos or tutorials describing how to do this. Everything is all in one form, so no need for any protected strings or anything.

    My question essentially is, how does one assign user input from a texbox to a string, and then display that specific string into a different textbox?

    Thank you for your time! Hopefully this isn't a dumb question

  2. #2
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,283

    Re: Strings in Texboxes

    There is no such thing as a dumb question. Like Einstein said. It is not answers that change the world, it is questions....

    Back to your question.

    Anything that is entered into a Textbox is automatically a string. That is the beauty of the Textbox.

  3. #3
    Join Date
    Dec 2008
    Posts
    144

    Re: Strings in Texboxes

    You automatically get the textbox's contents as a string when you call the .Text property. What you're trying to do is very basic- you can combine all of the field data with simple concatenation in a new string, or you can use a StringBuilder (see google) if you need a little more flexibility.
    Code:
    if (Issue.Resolved)
    {
         ThreadTools.Click();
         MarkThreadResolved();
    }

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured