Results 1 to 2 of 2

Thread: Display from a listbox selection

  1. #1

    Thread Starter
    Member
    Join Date
    May 2001
    Posts
    37

    Exclamation Display from a listbox selection

    i have used this code to display First Name from a .txt file to a Listbox
    Private Sub cmdOpen_Click()
    lstName.Clear
    If txtFile.Text = "" Then
    MsgBox "No filename entered", vbInformation, "Error!"
    Else
    Open txtFile.Text For Input As #1
    Do While Not EOF(1)
    Input #1, strFirstName, strLastName, strPhone, strDate
    lstName.AddItem strFirstName
    Loop
    Close #1
    End If
    End Sub
    Private Sub lstName_ItemCheck(Item As Integer)
    ...? ? ? ?...
    End Sub

    What I would like help to code is a:
    1) return a msgbox if the filename entered does not exist when cmdOpen is clicked
    2) when a string(FirstName) from the listbox display is selected the other data associated to that selection(LastName, Phone, DOB) is shown in corresponding label boxes

    thanx in advance

  2. #2

    Thread Starter
    Member
    Join Date
    May 2001
    Posts
    37
    I was trying to get the date to display in a caption and i was told i need to make use of the CDate() function.
    I was given this example
    strDate="26/07/1975"
    dteMyBDay = CDate(strDate)
    Can somebody please explain to me how to use this function in my code

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