How to display a character of arrays in a textbox in Visual C#

Posted on 2009-02-17
Last Modified: 2012-06-27
This is related to a question I asked previously. I have an array of characters which I wish to assign to a textbox. To assign from the textbox to the array of characters, buffer, to the textbox, txtBox, I was given the following solution which works:

char[] buffer = System.Text.ASCIIEncoding.ASCII.GetChars(

Now, I need to do the opposite, but am not sure how to do it.

Would appreciate your help.
Question by:geeta_m9
    LVL 29

    Accepted Solution

    txtBox.Text = new string(buffer);
    LVL 5

    Expert Comment

    Use this:

    foreach (char c in buffer ){
        txtBox.Text+= c.ToString();
    LVL 5

    Expert Comment

    gauthampjs' solution is much better. Please use that :)
    LVL 26

    Expert Comment

    by:Anurag Thakur
    dosent this work
    buffer.ToString ();
    LVL 29

    Assisted Solution

    Of course the first solution good and works.

    The second one is much slower because of loop.

    This one is as fast as the first one

    TextBox1.Text = string.Concat(buffer);

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Suggested Solutions

    In one of my recent projects, I was working with IP cameras, I need to take some pictures from the camera and do some processing on it. The first step, was to retrieve the image from camera into Image object. So that it can be displayed or …
    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now