Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7893391
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T07:07:16+00:00 2026-06-03T07:07:16+00:00

I am having trouble getting my chat application working correctly. I have 2 textbox’s,

  • 0

I am having trouble getting my chat application working correctly. I have 2 textbox’s, 1 to type what you would like to send, and another to display the conversation. For now I am trying to display what the user enters in the typeBox In the displaybox. I imagine I need an array or list of type string and add the entered text to it each time the button is pressed, then print the array/list to the displaybox. I have been trying a few approaches but I cant quite get it working correctly.

Could anyone shed some light on what approach to take ?

EDIT:

This is the code which I have so far. It is print out the array but without a line break and It fails to clear the display box each time, so I am getting duplicated of the same messages appearing.

    string ArrayData = string.Empty;
    ArrayList listData = new ArrayList();

    private void button1_Click(object sender, EventArgs e)
    {
        listData.Add(entryBox.Text);

        foreach (string textItem in listData)
        {

            ArrayData = "You >> " +ArrayData + textItem + "\n";

        }
        entryBox.Focus();
        displayBox.Text = "";
        displayBox.Refresh();
        this.displayBox.Text = ArrayData;
        entryBox.Text = "";

    }

This is probably obvious what Is wrong here but Ive been looking at it so long I cant see it.

Cheers,

: Dan

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T07:07:18+00:00Added an answer on June 3, 2026 at 7:07 am

    wouldn’t appending the string in the inputbox with \n to the string in the display box solve your problem? you do not need to save each line in an array or arraylist

    Pseudocode

    onclick
    displaybox.text = displaybox.text + inputbox.text +"\n"
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having trouble getting the font I would like to use, Chalkboard, to
Hi guys I'm having trouble getting my code to correctly display html within the
I've been having trouble getting my ASP.NET application to automatically log users into the
I am having trouble getting my ASP.NET application to start an application. For example
Having trouble getting the correct bounds for my iPad application when launching it in
Having trouble getting this to work. What's strange is that I have 10 bookmarks
I have been having trouble getting the screen dimensions for android. I do not
Im having trouble getting a function within a function working, do you think what
having trouble getting multiple lines to work correctly in a mailto link In my
I'm having trouble getting PHP's session_regenerate_id() to work in an application I'm developing. The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.