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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T20:59:03+00:00 2026-05-16T20:59:03+00:00

Hi all i am having a form namely addbatch and i will have some

  • 0

Hi all i am having a form namely addbatch and i will have some textboxes and 3 buttons namely save cancel addentry. When i given some sort of values on my form i will check for a condition as

   if(file.Length<95)
   {
      // I will raise an error
    }

When the user clicks on Addentry button i would like to show a new form and if the use fills some sort of details and click on save i would like to append all the data to the previous form after the last entry of the previous form.

I have my class file for batch as follows

public bool saveBatchHeader(string m_strPath)
    {
        StringBuilder sb = new StringBuilder();
        sb.AppendLine();
        sb.Append(m_strRecordTypeCode.PadLeft(1, '0'));
        sb.Append(m_strServiceClassCode.PadLeft(3, '0'));
        sb.Append(m_strCompanyName.PadRight(16, ' '));
        sb.Append(m_strCompanyDiscretionaryData.PadRight(20, ' '));
        sb.Append(m_strCompanyIdentification.PadRight(10, ' '));
        sb.Append(m_strStandardEntryClassCode.PadRight(3, ' '));
        sb.Append(m_strCompanyEntryDescription.PadRight(10, ' '));
        string m_strCompanyDescripDate = m_strCompanyDescriptiveDate.Replace("/", "");
        sb.Append(m_strCompanyDescripDate.PadLeft(6, '0'));
        string m_strEffDate = m_strEffectiveEntryDate.Replace("/", "");
        sb.Append(m_strEffDate.PadLeft(6, '0'));
        sb.Append(m_strJulianDate.PadRight(3, ' '));
        sb.Append(m_strOriginatorStatusCode.PadRight(1, ' '));
        sb.Append(m_strOriginationDFIIdentification.PadLeft(8, '0'));
        sb.Append(m_strBatchNumber.PadLeft(7, '0'));
        sb.Replace("\r\n", String.Empty);
        **int len = sb.Length;
        if (len < 95)
        {
            m_flag = false;
        }**
        else
        {
            StreamWriter sw = File.AppendText(m_strPath);
            sw.Write(sb);
            sw.Close();

        }
        return m_flag;
    }

How to append the next form data to that string builder and how can i save my file

Hi this is my second code

   public bool saveEntry(string strPath)
    {
        m_flag = true;
        string FileName = strPath;
        string m_strDate = DateTime.Now.ToString("MM/dd/yyyy");
        m_strDate = m_strDate.Replace("/", "");
        strPath += "/CCD_EntryDetailRecord_" + m_strDate + ".txt";

        using (TextWriter tw = new StreamWriter(strPath))
        {
            tw.Write(m_strRecordTypeCode.PadLeft(1, '0'));
            tw.Write(m_strTransactionCode.PadLeft(2, '0'));
            tw.Write(m_strRecievingDFIIdentification.PadLeft(9, '0'));
            tw.Write(m_strDFIAccountNumber.PadRight(17, ' '));
            tw.Write(m_strAmount.PadLeft(10, '0'));
            tw.Write(m_strIdentificationNumber.PadRight(15, ' '));
            tw.Write(m_strRecievingcompanyName.PadRight(22, ' '));
            tw.Write(m_strDiscretionaryData.PadRight(2, ' '));
            tw.Write(m_strAddendaRecordIndicator.PadLeft(1, '0'));
            tw.Write("TTTTBBBBZZZZZZZ");
            tw.WriteLine();
            tw.Flush();
            tw.Close();
    }

What ever data here entered should be appended after
sb.Append(m_strBatchNumber.PadLeft(7, ‘0’));
whcih was in the first code. AFter that i have to recheck my condition if it is ok i will write it to the required file..

  • 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-16T20:59:04+00:00Added an answer on May 16, 2026 at 8:59 pm

    You should create the StringBuilder in your first form and pass it to the second form (instead of creating it there). You can do it either in the form’s constructor, or create a separate setter property.

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

Sidebar

Related Questions

No related questions found

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.