Avatar of sud
sud

asked on 

modifying textbox content before storing in a file

Hi Experts,
    I am trying to upload the content of a textbox to a file. I can do that.

If a user write something like this in the textbox:

pharmgkbnumber     date             techid     sampleid     samplesource      number     note  
P123455               07/11/2005      wen        1                  rell                  -288      gklfglkfkkl
P123456               07/11/2005       pen         2                  mll                  -300   -200    jfdlgjlfd

i want it to modifiy it and upload in a text file something like

pharmgkbnumber     date             techid     sampleid     samplesource      number     note  
P123455               07/11/2005      wen        1                  rell                  -288      gklfglkfkkl
P123456               07/11/2005       pen         2                  mll                  -300      jfdlgjlfd
P123456               07/11/2005       pen         2                  mll                  -200      jfdlgjlfd

what is the bestway to do it ?

here is my code:

namespace TextUpload
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
        }
        private void Button1_click(object sender, System.EventArgs e) {

///to verify first line of the textbox

if (TextBox1.Text.IndexOf("pharmgkbnumber     date     techid     sampleid     samplesource     number     note") != 0)
  return;

 StreamWriter writer = new  StreamWriter("C:\\temp.txt");
writer.WriteLine( TextBox1.Text );
writer.Close();

               }
    }
}


Appreciate your help. Thanks,

Sudhir
C#

Avatar of undefined
Last Comment
sud

8/22/2022 - Mon