Results 1 to 5 of 5

Thread: How to get rid of line numbers in VB code

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2000
    Location
    Sydney, Australia
    Posts
    196

    Exclamation

    Does anyone know of a tool (like an addin) that will get rid of line numbers in the source code. I'm working on code that was taken from VB3 and there are line numbers galore in it that i'd like to get rid of.

    Thanks,


  2. #2
    Guest
    I have not used VB3, however, I'm sure you can design your own program to do this. For instance, it will read the file line by line and subract every letter before a semi-colon (assuming the lines appear as follows)

    Code:
    10:   Me.Caption = "Hello"   
    20:   Me.BackColor = vbBlue
    30:   Me.ForeColor = vbGreen

  3. #3
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    Auckland, NZ
    Posts
    411

    hehehe

    Megatron is too young to remember line numbers

    They don't need to have a colon. Line labels do however which is what you're thinking of. I don't know if VB3 supported labels.

    Megatron's suggestion is still valid however. Just look on every line of code to see if

    Code:
    If Instr(1,"0123456789",Left(line,1))<>0 Then
      line = mid(line,instr(1," :",line))
    End If
    Without testing it, the code above looks like it should get you somewhere.

    Let us know how you get on or if you need more help.

    Regards
    Paul Lewis

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Jan 2000
    Location
    Sydney, Australia
    Posts
    196
    Thanks guys, Yeah i'll try that code, was jsut looking for the easy way with a per-written adin, but i could write my own.

    Paul, in that code the line:

    Code:
    line = mid(line,instr(1," :",line))
    is still looking for a space-colon, but that need not exist i think. But i know it's just off the top of your head and i'm not picking. Basically the answer is to write some code to do it myself - so thats no probs, i can do that.

    Yeah vb3 does support line labels, unfortunately in my case. This vb3 app uses GoTo left right and centre. It even uses unconditional GoTo's to implement loops - scary...

    First step is to get rid of line numbers, second step use (i think Serge's) VBFormat to make the code look nice, third step: hope that 1 and 2 make it easier to understand...

    Anyway, thanks again...

  5. #5
    Hyperactive Member
    Join Date
    Jun 2000
    Location
    Auckland, NZ
    Posts
    411

    oops

    Err.. Yes you are right. I tried to use InStr to do what I have my own function to do. I have a simple function that returns the first or last occurrence of any of the characters in the search string.

    Using InStr I need to use two commands etc. But you got the picture which is fine...

    Cheers
    Paul Lewis

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