Results 1 to 4 of 4

Thread: VB6 and simple coding?

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2007
    Posts
    1

    VB6 and simple coding?

    Not sure this is the right forum to ask this question.

    Im just wondering if VB6 is suitable to do the following task:

    * Read a log file, the first line and the last line.
    * Find certain texts in the log and extract a number from each found.

    While this might look simple, in some coding environments its not sadly. For an example in autoit its extremely complicated.

    For example a text could look like this:
    [01:04:12] You get 1,402,421 experience points!
    The number (1,402,421) would then be added with the next one found until the file has reached the last line.

    But yeah, thats the question. I know of course that is is possible, but how hard would this be to code in VB6?

  2. #2
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: VB6 and simple coding?

    That would be quite simple in either VB6 or .NET. If you have not used either one, then I would suggest going with .NET, because VB6 is no longer supported by MS, and is probably going to fade over time. The steps would be these:

    1) Read the lines into an array of strings or similar structure in memory (faster and easier than dealing with the file)
    2) Find the lines that have the text you are looking for.
    3) Use InStr, Substring, Left, Right, Mid, etc (depending on the language) to extract the portion of the string you want.
    4) Convert it into a number.
    5) Add.
    6) Repeat until you've gone through all the lines.

    The exact coding for each step depends largely on the language chosen, but the steps will be the same.
    My usual boring signature: Nothing

  3. #3
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: VB6 and simple coding?

    VB is overkill, even. You could probably do that quite simply using head, tail and grep.

    UNIX utilities for Windows

    But if you don't know how to use those then don't bother learning just for this task. VB6 is fine.

  4. #4
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: VB6 and simple coding?

    Pen, you're cheating - you're a Unoid.
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width