Read sequential file using VB

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • leesa

    Read sequential file using VB

    I have a number field in a sequential file. Im going to read this file,
    sum up this number and display the grand total in my application using
    VB. Do anyone know how to do that??


    Thanks in advance!

  • Cor Ligthert [MVP]

    #2
    Re: Read sequential file using VB

    Leesa,
    [color=blue]
    >I have a number field in a sequential file. Im going to read this file,
    > sum up this number and display the grand total in my application using
    > VB. Do anyone know how to do that??
    >[/color]
    This is so basic programming.
    Try to get a book about programming it does not matter how old it is.
    Than get VBExpress

    What you have to do is open a windowsform project
    Drag from the toolbox a label on the form that is created
    Click on that form
    Search for MSDN.microsoft. com for "streamread er"
    Follow one of the samples on that page

    I hope this helps,

    Cor


    Comment

    • Homer J Simpson

      #3
      Re: Read sequential file using VB


      "leesa" <angkuku@gmail. com> wrote in message
      news:1144208387 .621836.56240@v 46g2000cwv.goog legroups.com...[color=blue]
      >I have a number field in a sequential file. Im going to read this file,
      > sum up this number and display the grand total in my application using
      > VB. Do anyone know how to do that??[/color]

      Dim fileReader As System.IO.Strea mReader
      fileReader = My.Computer.Fil eSystem.OpenTex tFileReader ("C:\File.tx t")
      Dim myData As String
      Do
      myData = fileReader.Read Line()
      Loop While Not fileReader.EndO fStream



      Comment

      • Cor Ligthert [MVP]

        #4
        Re: Read sequential file using VB

        Homer,

        If you write it so exact, would you not count in the routine.

        Something as
        [color=blue]
        > Dim fileReader As System.IO.Strea mReader
        > fileReader = My.Computer.Fil eSystem.OpenTex tFileReader ("C:\File.tx t")
        > Dim myData As String[/color]
        label1.text = ""[color=blue]
        > Do
        > myData = fileReader.Read Line()[/color]
        Label1.text = CDbl(Label1.Tex t) + CDbl(myData.Sub string(0,6))
        'to count the first 6 characters
        [color=blue]
        > Loop While Not fileReader.EndO fStream
        >[/color]
        :-))

        Cor


        Comment

        • Homer J Simpson

          #5
          Re: Read sequential file using VB


          "Cor Ligthert [MVP]" <notmyfirstname @planet.nl> wrote in message
          news:uKw8AiHWGH A.128@TK2MSFTNG P05.phx.gbl...

          [color=blue]
          > If you write it so exact, would you not count in the routine.
          >
          > Something as[/color]
          ....

          Sure. I have a bunch of code in there for my purpose but the OP needs to add
          his summing code.



          Comment

          • anzhi

            #6
            Re: Read sequential file using VB

            hi Cor and Homer,

            Thanks for ur explanation and code example ya. Very grateful to get
            feedback from u guys. thanks!

            Comment

            Working...