Click here to Skip to main content
15,917,709 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Big Bug in ComboBox control Pin
Christian Graus26-May-05 11:35
protectorChristian Graus26-May-05 11:35 
GeneralReading a txt file in textbox from listview Pin
WetRivrRat25-May-05 17:26
WetRivrRat25-May-05 17:26 
GeneralRe: Reading a txt file in textbox from listview Pin
Christian Graus25-May-05 17:38
protectorChristian Graus25-May-05 17:38 
GeneralRe: Reading a txt file in textbox from listview Pin
WetRivrRat26-May-05 2:53
WetRivrRat26-May-05 2:53 
GeneralRe: Reading a txt file in textbox from listview Pin
Dave Kreskowiak26-May-05 3:45
mveDave Kreskowiak26-May-05 3:45 
GeneralRe: Reading a txt file in textbox from listview Pin
Christian Graus26-May-05 11:39
protectorChristian Graus26-May-05 11:39 
GeneralRe: Reading a txt file in textbox from listview Pin
WetRivrRat26-May-05 13:05
WetRivrRat26-May-05 13:05 
GeneralRe: Reading a txt file in textbox from listview Pin
Christian Graus26-May-05 14:14
protectorChristian Graus26-May-05 14:14 
wetrivrrat wrote:
Well, now that you're awake.........

ROTFL - barely...

wetrivrrat wrote:
".SelectedItems.Tag" after that change I am unable to then use "Tag" as "Tag is not a memeber of System.Windows.Form.ListView.SelectedListViewItemCollection"

Gosh - you're getting a bit confused here. A SelectedListViewItemCollection contains SelectedListViewItems. I've just mocked up a VB.NET project ( I hate how you can't add events in the form designer, but.... ), here's my code:

Private Sub ListView1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListView1.DoubleClick
Dim ListViewItem As New ListViewItem
Try
System.Diagnostics.Process.Start(ListView1.SelectedItems(0).Text)
Catch ex As Exception
' This is a BAD idea - catch only the exception that you foresee as being likely, in this case:
' System.IO.FileNotFoundException()
MsgBox(Err.Description, vbCritical, "Error " & CStr(Err.Number))
End Try

End Sub

Also, forget this Err.Number drivel, it's a holdover from VB6, isn't it ? It's sure a waste of time. You have an exception object which will give you a detailed error string and a call stack, so use it. The main reason I hate VB.NET is that they didn't deprecate all this stuff that VB6 users will keep using, although they shouldn't. While we're at it, don't use CStr, use .ToString, that's what it's for.

So if multiselect is turned off, there'll only be one selected item ( there has to be one, there was a double click event ). So you grab it using SelectedItems(0), and then you have the item, you can grab column values if needed, I just used .Text to get the text displayed on screen. Now, the only issue is if you're showing a filename and not a full path, you need to rebuild your path for the execute command to work.

Christian Graus - Microsoft MVP - C++
GeneralRe: Reading a txt file in textbox from listview Pin
WetRivrRat26-May-05 15:02
WetRivrRat26-May-05 15:02 
GeneralRe: Reading a txt file in textbox from listview Pin
Christian Graus26-May-05 15:07
protectorChristian Graus26-May-05 15:07 
GeneralRe: Reading a txt file in textbox from listview Pin
WetRivrRat26-May-05 15:31
WetRivrRat26-May-05 15:31 
GeneralRe: Reading a txt file in textbox from listview Pin
Christian Graus26-May-05 15:33
protectorChristian Graus26-May-05 15:33 
GeneralRe: Reading a txt file in textbox from listview Pin
Dave Kreskowiak27-May-05 2:14
mveDave Kreskowiak27-May-05 2:14 
GeneralRe: Reading a txt file in textbox from listview Pin
Dave Kreskowiak27-May-05 2:15
mveDave Kreskowiak27-May-05 2:15 
GeneralRe: Reading a txt file in textbox from listview Pin
Christian Graus27-May-05 2:45
protectorChristian Graus27-May-05 2:45 
GeneralConnect to MS Outlook Pin
dw192825-May-05 16:01
dw192825-May-05 16:01 
GeneralRe: Connect to MS Outlook Pin
pfalco26-May-05 10:48
pfalco26-May-05 10:48 
GeneralImages in a Usercontrol Pin
tibmark25-May-05 15:57
tibmark25-May-05 15:57 
GeneralRe: Images in a Usercontrol Pin
Christian Graus25-May-05 16:05
protectorChristian Graus25-May-05 16:05 
GeneralRe: Images in a Usercontrol Pin
tibmark25-May-05 16:18
tibmark25-May-05 16:18 
GeneralRe: Images in a Usercontrol Pin
Christian Graus25-May-05 16:22
protectorChristian Graus25-May-05 16:22 
GeneralRe: Images in a Usercontrol Pin
tibmark25-May-05 16:47
tibmark25-May-05 16:47 
GeneralRe: Images in a Usercontrol Pin
Christian Graus25-May-05 16:49
protectorChristian Graus25-May-05 16:49 
GeneralRe: Images in a Usercontrol Pin
tibmark25-May-05 16:54
tibmark25-May-05 16:54 
GeneralRe: Images in a Usercontrol Pin
Christian Graus25-May-05 17:00
protectorChristian Graus25-May-05 17:00 

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.