Reading/Writing Registry Entries?

Discussion in 'AutoCAD' started by pkirill, Apr 9, 2004.

  1. pkirill

    pkirill Guest

    So, I've got this little VB routine that batch processes files for printing,
    binding, saving, etc. I've added a component that allows users to Archive
    drawings as well. Basically all this does is prompt the user for an
    "Archive Title", creates a folder named "Job Number + Archive Title + Date",
    then copies the selected files to that folder.

    I want to change the prompt for archive from a simple text box to a Combo
    Box where the user can either pick from say the last 10 entries or enter a
    new one. I figure this could be handled either from a text file or the
    registry. Neither of which I currently know how to do.

    Can anyone give me some pointers as which solution might be better and how
    to go about getting started?

    Thanks!
     
    pkirill, Apr 9, 2004
    #1
  2. Use the SaveSetting and the GetSetting which save to the registry.

    This is what I use to read a text file:

    <snip>
    Dim strMatText As String
    Dim strFileName As String
    Dim Filehandle%

    strFileName = "I:\Borders\BuffInd Menu\BOM Material.txt"

    Filehandle% = FreeFile
    Open strFileName For Input As #Filehandle%
    MousePointer = fmMousePointerHourGlass
    Do While Not EOF(Filehandle%)
    Line Input #Filehandle%, strMatText
    cboMaterial.AddItem strMatText
    Loop
    MousePointer = fmMousePointerDefault
    Close #Filehandle%
    <snip>
    --

    Thanks,

    David M. Gardner
    Change the DOT to reply.
     
    David M. Gardner, Apr 9, 2004
    #2
  3. Use an XML or INI file, or worst case a regular text file. The first two
    are preferable to a text file because they are structured and easier to
    access. Search the ng or www.codehound.com for examples.

    The registry is good for the location of this file say, but not for storing
    continually changing data. Some will disagree but the simple fact is there
    is already too much crap in the reg.
     
    Mike Tuersley, Apr 10, 2004
    #3
  4. pkirill

    pkirill Guest

    thanks David - that's been a big help.

    I have the form set to read and write to the external file - but I have one
    more question...

    How difficult would it be to insert the form data at the TOP of the external
    file? I figured out how to append it, but not how it insert it...

    Any ideas?
     
    pkirill, Apr 13, 2004
    #4
  5. I don't think I can help with that as someone helped me with the code I
    gave. I'm still in that stage of all most a real programmer. My skills are
    very limited. Sorry I can't be anymore help.

    --

    Thanks,

    David M. Gardner
    Change the DOT to reply.
     
    David M. Gardner, Apr 13, 2004
    #5
  6. Create a new file.
    Append the original file to the new file.
    Kill the original file.
    Rename the new file.

    Regards - Nathan
     
    Nathan Taylor, Apr 14, 2004
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.