Getting started, Visual Basic beginner

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

    #1

    Getting started, Visual Basic beginner

    Hi, I do apologize as I'm sure this kind of post is frowned on... But
    I'm stumped and just need a kick in the right direction...

    I'm using Visual Basic 2008 Express Edition.

    My goal: Take input from a TextBox, check it for a certain string, and
    output the remainder of the line to a file.

    I've just about everything working, except the part that gets the
    remainder of the line. That is the part that has got me stumped.
    This is what I have (and I welcome and criticism/advice)

    Dim sOutput As String
    Dim iPos As Integer
    Dim sData As String
    Dim sChar As String
    Dim iLooking As Integer
    Dim sInput As String
    sInput = RegistrationInp ut.Text
    iPos = InStr(sInput, "1a_firstna me: ")
    If iPos = 0 Then
    sOutput = "1a_firstna me: Not found!"
    Else
    iLooking = iPos + 14
    sChar = GetChar(sInput, iLooking)
    While sChar IsNot vbCrLf
    iLooking += 1
    sData += sChar
    sChar = GetChar(sInput, iLooking)
    End While
    sOutput = sData
    End If
    My.Computer.Fil eSystem.WriteAl lText("C:\My Computer
    \conference_reg .txt", sOutput, False)
  • Miro

    #2
    Re: Getting started, Visual Basic beginner

    Take a look here,



    by step 3 you should have what you are looking for and in the right
    direction.

    Miro

    "brock" <brockfanning@g mail.comwrote in message
    news:26ef8de7-51f5-44bd-9514-3bf896b8de07@s1 2g2000prg.googl egroups.com...
    Hi, I do apologize as I'm sure this kind of post is frowned on... But
    I'm stumped and just need a kick in the right direction...
    >
    I'm using Visual Basic 2008 Express Edition.
    >
    My goal: Take input from a TextBox, check it for a certain string, and
    output the remainder of the line to a file.
    >
    I've just about everything working, except the part that gets the
    remainder of the line. That is the part that has got me stumped.
    This is what I have (and I welcome and criticism/advice)
    >
    Dim sOutput As String
    Dim iPos As Integer
    Dim sData As String
    Dim sChar As String
    Dim iLooking As Integer
    Dim sInput As String
    sInput = RegistrationInp ut.Text
    iPos = InStr(sInput, "1a_firstna me: ")
    If iPos = 0 Then
    sOutput = "1a_firstna me: Not found!"
    Else
    iLooking = iPos + 14
    sChar = GetChar(sInput, iLooking)
    While sChar IsNot vbCrLf
    iLooking += 1
    sData += sChar
    sChar = GetChar(sInput, iLooking)
    End While
    sOutput = sData
    End If
    My.Computer.Fil eSystem.WriteAl lText("C:\My Computer
    \conference_reg .txt", sOutput, False)

    Comment

    • brock

      #3
      Re: Getting started, Visual Basic beginner

      On Mar 18, 12:27 pm, "Miro" <m...@beero.com wrote:
      Take a look here,
      >
      http://www.planet-source-code.com/vb...sp?txtCodeId=1...
      >
      by step 3 you should have what you are looking for and in the right
      direction.
      >
      Miro
      >
      "brock" <brockfann...@g mail.comwrote in message
      >
      news:26ef8de7-51f5-44bd-9514-3bf896b8de07@s1 2g2000prg.googl egroups.com...
      >
      Hi, I do apologize as I'm sure this kind of post is frowned on... But
      I'm stumped and just need a kick in the right direction...
      >
      I'm using Visual Basic 2008 Express Edition.
      >
      My goal: Take input from a TextBox, check it for a certain string, and
      output the remainder of the line to a file.
      >
      I've just about everything working, except the part that gets the
      remainder of the line. That is the part that has got me stumped.
      This is what I have (and I welcome and criticism/advice)
      >
      Dim sOutput As String
      Dim iPos As Integer
      Dim sData As String
      Dim sChar As String
      Dim iLooking As Integer
      Dim sInput As String
      sInput = RegistrationInp ut.Text
      iPos = InStr(sInput, "1a_firstna me: ")
      If iPos = 0 Then
      sOutput = "1a_firstna me: Not found!"
      Else
      iLooking = iPos + 14
      sChar = GetChar(sInput, iLooking)
      While sChar IsNot vbCrLf
      iLooking += 1
      sData += sChar
      sChar = GetChar(sInput, iLooking)
      End While
      sOutput = sData
      End If
      My.Computer.Fil eSystem.WriteAl lText("C:\My Computer
      \conference_reg .txt", sOutput, False)
      Perfect! Thanks a bunch!

      Comment

      • Cor Ligthert[MVP]

        #4
        Re: Getting started, Visual Basic beginner

        brock,

        Be aware that the article is written by a beginner.
        It starts already with something that is an own opinion about VB for Net,
        not something that is as needed.

        Cor

        "brock" <brockfanning@g mail.comschreef in bericht
        news:0dbe65d4-1465-46f8-87c9-8d9b1ce313e3@s8 g2000prg.google groups.com...
        On Mar 18, 12:27 pm, "Miro" <m...@beero.com wrote:
        >Take a look here,
        >>
        >http://www.planet-source-code.com/vb...sp?txtCodeId=1...
        >>
        >by step 3 you should have what you are looking for and in the right
        >direction.
        >>
        >Miro
        >>
        >"brock" <brockfann...@g mail.comwrote in message
        >>
        >news:26ef8de 7-51f5-44bd-9514-3bf896b8de07@s1 2g2000prg.googl egroups.com...
        >>
        Hi, I do apologize as I'm sure this kind of post is frowned on... But
        I'm stumped and just need a kick in the right direction...
        >>
        I'm using Visual Basic 2008 Express Edition.
        >>
        My goal: Take input from a TextBox, check it for a certain string, and
        output the remainder of the line to a file.
        >>
        I've just about everything working, except the part that gets the
        remainder of the line. That is the part that has got me stumped.
        This is what I have (and I welcome and criticism/advice)
        >>
        Dim sOutput As String
        Dim iPos As Integer
        Dim sData As String
        Dim sChar As String
        Dim iLooking As Integer
        Dim sInput As String
        sInput = RegistrationInp ut.Text
        iPos = InStr(sInput, "1a_firstna me: ")
        If iPos = 0 Then
        sOutput = "1a_firstna me: Not found!"
        Else
        iLooking = iPos + 14
        sChar = GetChar(sInput, iLooking)
        While sChar IsNot vbCrLf
        iLooking += 1
        sData += sChar
        sChar = GetChar(sInput, iLooking)
        End While
        sOutput = sData
        End If
        My.Computer.Fil eSystem.WriteAl lText("C:\My Computer
        \conference_reg .txt", sOutput, False)
        >
        Perfect! Thanks a bunch!

        Comment

        • Cor Ligthert[MVP]

          #5
          Re: Getting started, Visual Basic beginner

          Brock

          Don't declare all your local datanames in the top of a method, that is from
          before 1990
          Don't give all your datanames a prefix for the used value types
          Don't give your names which can mixed up by a keyword, by instance ichar
          would mean Interface for char. (as I have seen used by almost everybody)
          There is no need to tell what Type somethng is inside a method as VB 2008
          interfer that by the signature of the result.
          Dim a = "MyString"
          is perfectly well.

          Probably others see other things,

          Cor

          Comment

          Working...