need help with loading data

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • richy176
    New Member
    • May 2007
    • 8

    need help with loading data

    below is a load command button which loads data...what shows below is im trying to load some details from a label in one form onto a listbox in a different form. i dont know if the code below is correct but if anyone knows the problem, can someone help me correct it?

    thanks!

    Dim GName, YName As Variant (General Declarations)


    Private Sub cmdLoad_Click()

    Open "C:\student.txt " For Input As #1

    Input #1, GName, YName

    GList.List = GName
    YList.List = YName

    GList.AddItem (Student.lblGNa me.Caption)
    YList.AddItem (Student.lblYNa me.Caption)


    End Sub
  • Dököll
    Recognized Expert Top Contributor
    • Nov 2006
    • 2379

    #2
    Originally posted by richy176
    ...if anyone knows the problem, can someone help me correct it?

    thanks!
    Code:
    [B]Dim GName, YName As Variant (General Declarations)
    
    
    Private Sub cmdLoad_Click()
    
    Open "C:\student.txt" For Input As #1
    
    Input #1, GName, YName
    
    GList.List = GName
    YList.List = YName
    
    GList.AddItem (Student.lblGName.Caption)
    YList.AddItem (Student.lblYName.Caption)
    
    
    End Sub[/B]
    Hiya richy176!

    Do you also have a code that is loading the label names in your list box?

    Code:
    Open "C:\student.txt" For Output As #1
    If you load label names in, you should then be able to find them. Although, I am not sure if the code above will do what you need. Try recording label names in your student.txt and go from there.

    I should perhaps mention you can load label names in Form_Load:-)

    Dököll
    Last edited by Dököll; Jun 8 '07, 12:14 AM. Reason: Added remark...

    Comment

    Working...