Click here to Skip to main content
15,887,676 members
Home / Discussions / C#
   

C#

 
QuestionRetrieving multiple items from listview Pin
mrithula83-Apr-09 1:23
mrithula83-Apr-09 1:23 
AnswerRe: Retrieving multiple items from listview Pin
King Julien3-Apr-09 1:49
King Julien3-Apr-09 1:49 
GeneralRe: Retrieving multiple items from listview Pin
mrithula83-Apr-09 4:39
mrithula83-Apr-09 4:39 
GeneralRe: Retrieving multiple items from listview Pin
King Julien6-Apr-09 4:29
King Julien6-Apr-09 4:29 
GeneralRe: Retrieving multiple items from listview Pin
mrithula86-Apr-09 5:27
mrithula86-Apr-09 5:27 
GeneralRe: Retrieving multiple items from listview Pin
mrithula86-Apr-09 5:28
mrithula86-Apr-09 5:28 
GeneralRe: Retrieving multiple items from listview Pin
mrithula87-Apr-09 18:35
mrithula87-Apr-09 18:35 
GeneralRe: Retrieving multiple items from listview Pin
King Julien7-Apr-09 19:56
King Julien7-Apr-09 19:56 
ofcourse.... the code is working according to what it was written.

I assume that you are calling this code after you select the item from the listview.
In that case, have a close look at the for loop. every time the for loop counter initializes to 0
mrithula8 wrote:
for (int h = 0; h < sl.Count; h++)


it means that whatever you select, that will be assigned in order from the first label. Thats wat is happening....

If you want to display the listview item 1 in label 1, then you try getting the item number of the list view and use the same number as the index for the label control array and i think your problem could be solved.

for (int h = 0; h < sl.Count; h++)
 {
   lb[sl[i].Index].Text = sl[i].Text;
 }


Make sure that you have n number of labels if there are n number of items... otherwise it may throw you an exception....

Have a Happy Coding.....

GeneralRe: Retrieving multiple items from listview [modified] Pin
mrithula87-Apr-09 20:10
mrithula87-Apr-09 20:10 
GeneralRe: Retrieving multiple items from listview Pin
King Julien7-Apr-09 20:21
King Julien7-Apr-09 20:21 
GeneralRe: Retrieving multiple items from listview Pin
mrithula87-Apr-09 20:50
mrithula87-Apr-09 20:50 
GeneralRe: Retrieving multiple items from listview Pin
King Julien7-Apr-09 20:58
King Julien7-Apr-09 20:58 
GeneralRe: Retrieving multiple items from listview [modified] Pin
mrithula87-Apr-09 21:05
mrithula87-Apr-09 21:05 
GeneralRe: Retrieving multiple items from listview Pin
King Julien7-Apr-09 23:32
King Julien7-Apr-09 23:32 
GeneralRe: Retrieving multiple items from listview Pin
mrithula88-Apr-09 0:04
mrithula88-Apr-09 0:04 
GeneralRe: Retrieving multiple items from listview Pin
King Julien8-Apr-09 0:12
King Julien8-Apr-09 0:12 
GeneralRe: Retrieving multiple items from listview Pin
mrithula88-Apr-09 1:12
mrithula88-Apr-09 1:12 
GeneralRe: Retrieving multiple items from listview Pin
King Julien8-Apr-09 1:14
King Julien8-Apr-09 1:14 
GeneralRe: Retrieving multiple items from listview Pin
mrithula88-Apr-09 1:30
mrithula88-Apr-09 1:30 
GeneralRe: Retrieving multiple items from listview Pin
King Julien8-Apr-09 2:45
King Julien8-Apr-09 2:45 
QuestionHow append css in html at run time Pin
sushilabhanvar3-Apr-09 1:21
sushilabhanvar3-Apr-09 1:21 
AnswerRe: How append css in html at run time Pin
Rajdeep.NET is BACK3-Apr-09 1:42
Rajdeep.NET is BACK3-Apr-09 1:42 
QuestionInstall setup only on one PC Pin
sjs4u3-Apr-09 1:00
sjs4u3-Apr-09 1:00 
AnswerRe: Install setup only on one PC Pin
King Julien3-Apr-09 1:14
King Julien3-Apr-09 1:14 
AnswerRe: Install setup only on one PC Pin
Rajdeep.NET is BACK3-Apr-09 1:38
Rajdeep.NET is BACK3-Apr-09 1:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.