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 4026802
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:01:03+00:00 2026-05-20T11:01:03+00:00

So, I wanna know how to write the entire content of an array to

  • 0

So, I wanna know how to write the entire content of an array to a textbox by using a foreach loop in C#. My code currently looks like this:

I generate a series of random numbers which are stored in the array:

int[] iData;

Now I want to write the stored data in this array to a textbox by using the foreach loop like this:

        foreach (int myInt in iData)
        {
            txtListing.Text = myInt.ToString();
        }

This will only write the last generated number in the array to the textbox, but my question is how do I write all of them to the tekstbox.

I only know, how to do this with a listbox and a forLoop. But is there any way this can be done with a textbox and a foreach loop?

  • 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-05-20T11:01:04+00:00Added an answer on May 20, 2026 at 11:01 am

    Try using the AppendText method instead:

    foreach (int myInt in iData)
    {
        txtListing.AppendText(myInt.ToString());
    }
    

    Another option is to join the elements together as a string:

    textListing.Text = string.Join(string.Empty, iData);
    

    …or if you want another delimiter:

    textListing.Text = string.Join(", ", iData);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wanna to write code like this require 'sinatra' class MyModel def edit(request) #
Hi I wanna know how to write this in Javascript : var object {
This question is not language-aware. I wanna know how can I recognize a returning
Please help me!I dont know why i cant solve this simple problem. I wanna
I wanna know is it possible to make an operating like windows-xp which is
I am writing an installer using NSIS. I wanna know how to change or
I have a question about NSUserDefault. Currently, i wanna write a function which save
I know the following code can access outer this. var o = function() {
I wanna know is it using the power of HTML5 and jquery any sample
I building an application using rails, and I wanna know if is possible to

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.