Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. parsing .frm file for control names and nested level

parsing .frm file for control names and nested level

Scheduled Pinned Locked Moved Visual Basic
data-structurestoolsxmljson
4 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    john john mackey
    wrote on last edited by
    #1

    Hi, i searched around the Net and Code Project for some existing parser, but so far unsuccessful. What I want to do is parse a Visual Basic .FRM (form) file and extract the control names defined within. I also want to determine if there are nested controls within. If possible, convert the listing and nested information into some format that can be easily worked with by other tools - like XML or some identifiable tree structure. For example (MyForm.frm):

    Begin Control1Lib.Cntrl1 MyCntrl1
    Height = 555
    Left = 0
    ...
    Begin Control2Lib.Cntrl2 MyNestedCntrl2
    Height = 375
    ...
    BeginProperty Font {aldfladlf-lsl-ladsjlfj}
    ...
    EndProperty
    End
    End

    Then the parser could tell me I have two controls (MyCntrl1, MyNestedCntrl2) and SHOW that MyNestedCntrl2 is nested inside MyCntrl1.

    Examples:
    Level ControlName
    1.0 MyCntrl1
    1.1 MyNestedCntrl2
    2.0 MyCntrl2
    2.1 Nested2_1
    2.2 Nested2_2
    3.0 MyCntrl3
    3.1 Nested3_1
    3.1.1 Nested3_1_1
    3.1.1.1 Nested3_1_1_1
    ...

    XML example:

    I am sure this is somewhere out on the Net where I can download, so can you point me to the place to research? Thank you much! JJ

    D 1 Reply Last reply
    0
    • J john john mackey

      Hi, i searched around the Net and Code Project for some existing parser, but so far unsuccessful. What I want to do is parse a Visual Basic .FRM (form) file and extract the control names defined within. I also want to determine if there are nested controls within. If possible, convert the listing and nested information into some format that can be easily worked with by other tools - like XML or some identifiable tree structure. For example (MyForm.frm):

      Begin Control1Lib.Cntrl1 MyCntrl1
      Height = 555
      Left = 0
      ...
      Begin Control2Lib.Cntrl2 MyNestedCntrl2
      Height = 375
      ...
      BeginProperty Font {aldfladlf-lsl-ladsjlfj}
      ...
      EndProperty
      End
      End

      Then the parser could tell me I have two controls (MyCntrl1, MyNestedCntrl2) and SHOW that MyNestedCntrl2 is nested inside MyCntrl1.

      Examples:
      Level ControlName
      1.0 MyCntrl1
      1.1 MyNestedCntrl2
      2.0 MyCntrl2
      2.1 Nested2_1
      2.2 Nested2_2
      3.0 MyCntrl3
      3.1 Nested3_1
      3.1.1 Nested3_1_1
      3.1.1.1 Nested3_1_1_1
      ...

      XML example:

      I am sure this is somewhere out on the Net where I can download, so can you point me to the place to research? Thank you much! JJ

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      First, not to piss on your parade route, but WHY? VB6 is long since dead and not supported by anyone any more. What tools do you think are going to want to know this stuff when nobody is developing new tools for VB6? Second, the FRM file is just a text file. There really isn't any parser out there that I can find (probably because VB6 has been outdated for 10 years now) Writing one should be pretty straight forward.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak

      J 1 Reply Last reply
      0
      • D Dave Kreskowiak

        First, not to piss on your parade route, but WHY? VB6 is long since dead and not supported by anyone any more. What tools do you think are going to want to know this stuff when nobody is developing new tools for VB6? Second, the FRM file is just a text file. There really isn't any parser out there that I can find (probably because VB6 has been outdated for 10 years now) Writing one should be pretty straight forward.

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak

        J Offline
        J Offline
        john john mackey
        wrote on last edited by
        #3

        True that, and that's basically why i want to achieve what I'm asking... I have some legacy application and there are some 3rd party controls that have long since been retired. I want a method to identify all the controls in my application and determine what needs attention. My take on this would be to write my own simple parser to:

        1. search .FRM for "Begin" 2. for each "Begin", push onto a stack (var name, unique id, level++)
        3. for each "End", pop from stack, print info (id++, level--, var name)

        (you can see my c++ tendencies) It seemed quicker to ask the community before setting off and writing. Cheers.

        D 1 Reply Last reply
        0
        • J john john mackey

          True that, and that's basically why i want to achieve what I'm asking... I have some legacy application and there are some 3rd party controls that have long since been retired. I want a method to identify all the controls in my application and determine what needs attention. My take on this would be to write my own simple parser to:

          1. search .FRM for "Begin" 2. for each "Begin", push onto a stack (var name, unique id, level++)
          3. for each "End", pop from stack, print info (id++, level--, var name)

          (you can see my c++ tendencies) It seemed quicker to ask the community before setting off and writing. Cheers.

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          The logic seems reasonable. I'd start writing because you'll probably spend just as much effort to find something that does it for you.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups