Results 1 to 5 of 5

Thread: Need some help parsing a delimited text file

  1. #1

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Posts
    7

    Need some help parsing a delimited text file

    I need some help getting my program to open a delimited text file and placing the information in the correct text boxes.

    i have the following in the txt files
    †charles
    Intro to Win2k adv serv§Basic Admin course 3 days
    Intro to ISA Server§Basic ISA server Install and config course

    †is used to seperate users records
    then comes the course on a new line
    and the § seperates the course from its description

    i can get it to open the entire file for editing which is useless, i need to be able to send each peice, seperated by user to a different box, ie lists the users in a text box and when you click on a user it would update the crstxtbox and update the course and description. which need to be editable seperatly but saved together.

    I also have two other small things.

    I need to add in a new field for each record which is a small picture which is stored in a seperate directory. and when you open the record it open the image in a picture box, and if it doesn't have a picture listed in the record it leaves it blank or loads a default picture.

    and since many of these courses are the same i need the 2nd text box seperated with a drop down in which you can select the course, but not be limited to selecting a known course and be able to enter a new course

    I hope this makes some sense
    If some of you nice guys out there could help me with this. Also if you post code for if you have a chance could you please also post comments in it to what each part does, otherwise I am just coping and pasteing, and I would like to learn wht I am putting in so I can do it on my own next time I have a question

    thanks

    KC

  2. #2

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Posts
    7

    code i have so far

    Code:
    Private Sub mnuFileOpen_Click()
       
       If Not SaveComplete() Then Exit Sub
       
       
       On Error GoTo EH
       With ComDlg
          .CancelError = True
          .Filter = "DMT Files (*.dmt)|*.dmt|All Files (*.*)|*.*"
          .DefaultExt = ".dmt"
          .DialogTitle = "Open File"
          .FilterIndex = 1
          .Flags = cdlOFNHideReadOnly
          .ShowOpen
          If .FileName <> "" Then m_strFilename = .FileName
       End With
       
       LoadFile
       AddToMRUList m_strFilename
       
       Exit Sub
       
    
    EH:
       If Err.Number = cdlCancel Then
          Exit Sub
       Else
          MsgBox "ERROR: " & Err.Description _
             & ". [Error #" & Err.Number & "]", vbCritical
       End If
       
    End Sub

  3. #3
    PowerPoster
    Join Date
    Feb 2001
    Location
    Crossroads
    Posts
    3,046
    Are you stuck with using that format for your file? A database might work better if not.

    Otherwise I think you might have to bite the bullet and read in one character at a time until you find your delimiters.

  4. #4

    Thread Starter
    New Member
    Join Date
    Jul 2001
    Posts
    7

    not stuck with file format

    we have an exsisting program, some 1912 dos based thing, that i am trying to get rid of, i was just hoping to keep the exsisting file format, but if its too much work then I have no problem changing its format, but I know less about databases than I do about VB, which is already embarressing.

  5. #5
    PowerPoster
    Join Date
    Feb 2001
    Location
    Crossroads
    Posts
    3,046
    I would suggest using ADO and storing your information in an mdb file. I can post a short project to show you how to get it going if your interested.

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