Link to home
Start Free TrialLog in
Avatar of aplelois
aplelois

asked on

Listbox

hello,
I have a listbox that has 5 names coming from an ini file
and a 4 labels.
when you open the program you see the labels like this

first ame: name
last name: last
email: email
phone: 123456

and the listbox like this
person1
person2
person3
person4
person5

but when I select Person3 in the listbox it doesnt show the info
in the label, how can I do this?
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Hi aplelois;

How is the ListBox set up, DataSource, DisplayMember, Value member?

Where is the info for the person1, ..2, - ..5 being kept?

Fernando
Avatar of aplelois
aplelois

ASKER

how can I know that?
Hi aplelois;

OK, if you do not know that then I am assuming that you are not setting them.

Can you post the code for the ListBox events such as SelectedIndexChanged or any other code that is pertinent to what you want to do.

Fernando
       Dim ts As Object
        Dim i As Integer
        Dim sContent As String
        Dim vRows, vCells As Object

        fso = CreateObject("Scripting.FileSystemObject")
        ts = fso.OpenTextFile("Accounts.ini")
        sContent = ts.ReadAll
        ts.Close()

        vRows = Split(sContent, vbCrLf)
        For i = 0 To UBound(vRows)
            vCells = Split(vRows(i), ";")
            If UBound(vCells) >= 4 Then lstAccounts.Items.Add((vCells(4)))
        Next
        If lstAccounts.Items.Count > 0 Then lstAccounts.SelectedIndex = 0
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
aplelois & Fernando

This question and

https://www.experts-exchange.com/questions/21831990/edit-button.html

look to be linked.  So what is eventually done in the other may impact on this.  Something to bear in mind.

Roger
Thanks Roger. :=)
Error      1      Type 'StreamReader' is not defined.
Add this to the top of the code file:

Imports System.IO

Fernando
error
Post code file