[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to get data from selected in listview

Posted on 2007-11-21
6
Medium Priority
?
436 Views
Last Modified: 2008-02-01
I was using a listbox, code below

i changed to a listview, and now i need the numbers in the selected line and in column1 in a variable from the listview.

The question is, how do i get this number?

The code below is how i did it with a listbox, with that code you should understand what i mean :)
'Dim ordrevalg As String = Me.listordre.SelectedItem

Open in new window

0
Comment
Question by:leeds2000
  • 3
  • 3
6 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 20332256
Assumming column 1 is first one, this should be enough:

Dim ordregvalg as String = Me.listordre.SelectedItem.Text
0
 
LVL 3

Author Comment

by:leeds2000
ID: 20332271
No, you dont understand, that code is the one i used, i have a listview box now, not a listbox

I need to get the first number in the listview box (column 1) that is selected.

So i need the same function for the listview box, so the code above illustrates on a listbox

The code was only there to show what i mean with a listbox, i need to do the same for a listview box as i did for the listbox

you follow?
 
0
 
LVL 55

Accepted Solution

by:
Jaime Olivares earned 2000 total points
ID: 20332310
assumming you have anything selected in the listview, you can do this:

Dim ordregvalg as String = Me.listordre.SelectedItems(0).Text

This gets the contents of the first cell (column) in the first selected item (row)
Provide more detail to be more precise.
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 3

Author Comment

by:leeds2000
ID: 20332320
No need, that was just what i needed, THANKS :)
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 20332332
You have to notice this: if Me.listordre.SelectedItems.Count = 0, then the line proposed will produce an exception, you have to check this first.
0
 
LVL 3

Author Comment

by:leeds2000
ID: 20332342
Yes, i have it embedded in a try catch, this would capture any error :)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

834 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