?
Solved

listbot

Posted on 2006-04-28
9
Medium Priority
?
168 Views
Last Modified: 2010-04-23
hello,
I have a listbot that has 5 names coming from an ini file
and a label called names.
when you open the program you see Name: Person1
but when I select Person3 in the listbox it doesnt show
in the label, how can I do this?
0
Comment
Question by:aplelois
  • 6
  • 3
9 Comments
 
LVL 48

Accepted Solution

by:
AlexFM earned 2000 total points
ID: 16567579
Private Sub listBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles listBox1.SelectedIndexChanged
   ' Get the currently selected item in the ListBox.
   Dim curItem As String = listBox1.SelectedItem.ToString()

   ' set in in the label
   LabelName.Text = curItem
End Sub

0
 

Author Comment

by:aplelois
ID: 16567591
thanks a lot!
0
 

Author Comment

by:aplelois
ID: 16567607
well, I got a problem cause I have

first name
last name
email

ini file is
fist;last;email@dom.com;

so when I add in LabelName it only shows up the name
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 48

Expert Comment

by:AlexFM
ID: 16567614
Does listbox contain all fields?
I think you need ListView for this. It can contain three columns for first name, last name and email. Handle SelectedIndexChanged event and fill label with three fields or make three labels for every field.
0
 

Author Comment

by:aplelois
ID: 16567625
now it only shows the name
0
 

Author Comment

by:aplelois
ID: 16567632
ok listview sound great!
0
 

Author Comment

by:aplelois
ID: 16567641
I would like to show something like this

First Name: person1
Last Name: person2
Email: email

so when the ppl select the name from the listbox
it changes the infotmation to the person
how would I do that? something simple!
0
 
LVL 48

Expert Comment

by:AlexFM
ID: 16567663
Suppose you have ListView with three columns and three lables.

Private Sub ListView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) _
        Handles ListView1.SelectedIndexChanged

         Dim items As ListView.SelectedListViewItemCollection = _
            Me.ListView1.SelectedItems

         if ( items.Count > 0 ) then
             LabelName.Text = items(0).SubItems(0).Text
             LabelLastName.Text = items(0).SubItems(1).Text
             LabelMail.Text = items(0).SubItems(2).Text
         end if
End Sub
0
 

Author Comment

by:aplelois
ID: 16567730
how do I add a label to the listview I cant find the way
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Kernel Data Recovery is a renowned Data Recovery solution provider which offers wide range of softwares for both enterprise and home users with its cost-effective solutions. Let's have a quick overview of the journey and data recovery tools range he…
How can you see what you are working on when you want to see it while you to save a copy? Add a "Save As" icon to the Quick Access Toolbar, or QAT. That way, when you save a copy of a query, form, report, or other object you are modifying, you…
Suggested Courses

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question