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

  • Home
  • SEARCH
  • 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 7026761
In Process

The Archive Base Latest Questions

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

I know it sounds really stupid, but I have a really easy application that

  • 0

I know it sounds really stupid, but I have a really easy application that saves some data from some users on a database, and then I want to write all the data on a .txt file.

The code is as follows:

    List<MIEMBRO> listaMiembros = bd.MIEMBRO.ToList<MIEMBRO>();


    fic.WriteLine("PARTICIPACIONES GRATUITAS MIEMBROS: ");
    mi = new Miembro();
    foreach (MIEMBRO_GRATIS m in listaMiembroGratis)
    {
         mi.setNomMiembro(m.nomMiembro);
         mi.setNumRifa(m.numRifa.ToString());
         fic.WriteLine(mi.ToString());
    }
    fic.WriteLine();

As you see, really easy code. The thing is: I show the information on a datagrid and I know there are lots of more members, but it stops writing in some point.

Is there any number of lines or characters to write on the streamwriter?? Why I can’t write all the members, only part of them???

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

    fic is probably not being flushed by the time you are looking at the output file; if you instantiate it as the argument for a using block, it will be flushed, closed, and disposed of when you are done.

    Also, in case you are flushing properly (but it is not being flushed by the time you are checking the file), you could flush at the end of each iteration:

    foreach (MIEMBRO_GRATIS m in listaMiembroGratis)
    {
         mi.setNomMiembro(m.nomMiembro);
         mi.setNumRifa(m.numRifa.ToString());
         fic.WriteLine(mi.ToString());
         fic.Flush();
    }
    

    This will decrease performance slightly, but it will at least give you an opportunity to see which record is failing to write (if, indeed, an exception is being thrown).

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

Sidebar

Related Questions

I know that sounds really weird, but I am fairly new to C# and
I know this sounds like a really obvious question, but it's proving harder to
I know this sounds confusing: I have just built some basic prev/next pagination for
I know the question sounds silly, but consider this: I have an array of
I know, I know, its sounds silly, but it seems that there are no
I know this sounds really silly but what character encoding should I use for
That sounds really stupid. On Lubuntu 10.10, I did: echo deb http://oss.oracle.com/debian unstable main
I know this may sound stupid, but i really want to know :) im
OK I know the title sounds really confusing, but really it's quite simple. Consider
Usually that really sounds like an sbolutely simple task: I have a view and

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.