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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:32:48+00:00 2026-05-18T01:32:48+00:00

When I create the file and append to it the rest of the information

  • 0

When I create the file and append to it the rest of the information I now want to have the ability to read the text file then display the Month of a birthday thats listed in the file.
I want to be able to pull in just the info by birthday. So if I choose month 11 I want to pull in all the data entries that have a birthmonth of 11 by pushing button4.

This is what I have so far;

 private void close_Click(object sender, EventArgs e)
    {
        Close();
    }

    private void button1_Click(object sender, EventArgs e)
    {
        writetext();
        reset();

    }
    public void writetext()
    {

        using (TextWriter writer = File.AppendText("filename.txt"))

        {
         writer.WriteLine("First name, {0} Lastname, {1} Phone,{2} Day of birth,{3} Month of Birth{4}", textBox1.Text, textBox2.Text, maskedTextBox1.Text, textBox4.Text, textBox3.Text);
         MessageBox.Show(String.Format("First Name,{0} Lastname, {1} Phone,{2} Day of birth,{3} Month of Birth{4}", textBox1.Text, textBox2.Text, maskedTextBox1.Text, textBox4.Text, textBox3.Text)); 
        }
        }
    public void reset()
    {
        textBox1.Text = "";
        textBox2.Text = "";
        textBox3.Text = "";
        textBox4.Text = "";
        maskedTextBox1.Text = "";
    }

    private void button3_Click(object sender, EventArgs e)
    {
        Close(); 
     }

    private void button2_Click(object sender, EventArgs e)


    {
        readfile(); 


    }

    private void label7_Click(object sender, EventArgs e)
    {

    }

    private void button4_Click(object sender, EventArgs e)
    {

    }
    public void readfile()
    {
        string[] lines = File.ReadAllLines("filename.txt");
        label6.Text = String.Join(Environment.NewLine, lines);
    }
}






 }
  • 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-18T01:32:48+00:00Added an answer on May 18, 2026 at 1:32 am

    Same as Geoffrey but with C# and linq syntax:

    You can filter the content of your file using the birth date and store it in a new array this way:

    string[] persons = File.ReadAllLines(Server.MapPath("filename.txt"));
    IEnumerable<string> personsWithBirthday =
      from p in persons
        where p.Contains("1980-08-21")
          select p;
    foreach (var person in personsWithBirthday)
     Response.Write(person);
    

    I would recommend you to define a standard date format in order to easily grab all the persons matching the search criteria.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a file, save data and then append some information to
How to append text to a text file in C++? And create a new
I want to pre-append some text a a CSV file that is created by
I want to read a text file word by word in Qt4 (to which
what I want to do is just create CSV file initially and append to
Possible Duplicate: PHP create a file without fopen I want to create a file
I want to create a file with a block of code in it and
try { // Create an appending file handler boolean append = true; FileHandler handler
How to check that the file exists? How to append a text to the
Using VB.NET, I am trying to create a text file if it doesn't exist

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.