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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:38:09+00:00 2026-05-26T00:38:09+00:00

i create an array list and i want to print the content of the

  • 0

i create an array list and i want to print the content of the arraylist in a text file.

The programm take the values from the textboxes and store it in an arraylist and with the
add button,i want to store it in the text file in given location..

i am using Microsoft Visual C# 2010 Express

namespace WindowsFormsApplication1
{
   public partial class Form1 : Form
   {

     private ArrayList StoreItems;


    public Form1()
    {
        this.StoreItems = new ArrayList();

        InitializeComponent();
    }

    private void textBox1_TextChanged(object sender, EventArgs e)
    {

    }
    private void textBox2_TextChanged(object sender, EventArgs e)
    {

    }
    private void textBox3_TextChanged(object sender, EventArgs e)
    {

    }
    private void textBox4_TextChanged(object sender, EventArgs e)
    {

    }
    private void textBox5_TextChanged(object sender, EventArgs e)
    {

    }
    private void textBox6_TextChanged(object sender, EventArgs e)
    {

    }


    //add button
    private void button1_Click(object sender, EventArgs e)
    {

        // Make sure an item is complete before adding it to the inventory
        if (this.textBox1.Text.Equals(""))
        {
            MessageBox.Show("You must enter a code");
            this.textBox1.Focus();
            return;
        }

        if (this.textBox2.Text.Equals(""))
        {
            MessageBox.Show("You must provide the name of the item");
            this.textBox2.Focus();
            return;
        }

        if (this.textBox3.Text.Equals(""))
        {
            MessageBox.Show("You must provide the name of the supplier");
            this.textBox3.Focus();
            return;
        }

        if (this.textBox4.Text.Equals(""))
        {
            MessageBox.Show("You must enter the price per unit");
            this.textBox4.Focus();
            return;
        }

        if (this.textBox5.Text.Equals(""))
        {
            MessageBox.Show("You must enter the number of the required products");
            this.textBox5.Focus();
            return;
        }

        if (this.textBox6.Text.Equals(""))
        {
            MessageBox.Show("You must enter the number of the current stock level");
            this.textBox6.Focus();
            return;
            //string csl = this.textBox6.Text;
        }



        string inValue1, inValue2, inValue3, inValue4, inValue5, inValue6;
        inValue1 = textBox1.Text;
        inValue2 = textBox2.Text;
        inValue3 = textBox3.Text;
        inValue4 = textBox4.Text;
        inValue5 = textBox5.Text;
        inValue6 = textBox6.Text;

      /*  string result = (inValue1 + " " + inValue2 + " " + inValue3 + " "
            + inValue4 + " " + inValue5 + " " + inValue6);  */

        string result=(inValue1+inValue2+inValue3+inValue4+inValue5                    +inValue6);
        StoreItems.Add(result);



        System.IO.File.AppendAllText(@"C:\Users\v\Desktop\text.txt", Environment.NewLine + result);

    }

    private void button2_Click(object sender, EventArgs e)
    {

    }
  • 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-26T00:38:09+00:00Added an answer on May 26, 2026 at 12:38 am

    What version of .Net?

    public Form1()
    {
        InitializeComponent();
    
        private TextBox[] TextBoxes = {textBox1, textBox2, textBox3, textBox4, textBox5, textBox6};
    
        private List<string> storeItems = new List<string>();
    }
    
    private void button1_Click(object sender, EventArgs e)
    {
        var buffer = new StringBuilder();
        foreach(var textBox in textBoxes)
        {
            if (string.IsNullOrEmpty(textBox.Text))
            {
                textBox.BackColor = Color.FromName("LightSalmon");
                MessageBox.Show("This item cannot be left blank");
                textBox.Focus();
                return;
            }
            textBox.BackColor = Colors.FromName("Window");
            buffer.Append(textBox.Text);
        }
    
        var result = buffer.ToString();
        storeItems.Add(result);
        System.IO.File.AppendAllText(@"C:\Users\v\Desktop\text.txt", Environment.NewLine + result);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to create an array from a list of data in excel. The
Possible Duplicate: How to create comma separated list from array in PHP? My array
I've got an array of values that i'm using to create list items that
Possible Duplicate: How to create comma separated list from array in PHP? I have
I want to get the corresponding values from the second list based on the
This is how I create the array var list = $(#sortable).sortable('toArray'); $.ajax({ type: 'POST',
I am trying to create an array or list that could handle in theory,
I am trying to create a 2d array or list or something in Python.
I tried to create a single insert query for the values in template_list array.
This is the code in my view: echo $this->Form->create('Chart'); echo $this->Form->input('username', array('label'=>('Usernames List'), 'empty'=>('Select

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.