?
Solved

How to get data from selected in listview

Posted on 2007-11-21
6
Medium Priority
?
424 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
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 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

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

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

800 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