I understand what you are saying.
First, I never assume that a poster will be in the correct forum. All too often questions for VBA shows up in JAVA and MS Access in one of the other DB forums. To that extent, you will note that I have lightly "admonished" OP for failing to note which version of the BASIC language is being used.
Take a careful look at the code offered by OP... does it not strike you that the formatting is the same as would be seen from code that is from intellisense - such as from VS2005? It would also explain why OP is not seeing an error, it also explains the other behavior OP is observing (well, to a point).
Code taken directly from VS2005:
- ' Visual Basic 2005
-
Dim theItem As ListViewItem
-
If ListView1.SelectedItems.Count > 0 Then
-
theItem = ListView1.SelectedItems(0)
-
Else
-
theItem = Nothing
-
End If
You will also want to take note that OP could very well be using an ActiveX control... I'll stay within the VB6 editor reference:
Visual Studio 6.0 - SelectedItem Property (ActiveX Controls)
Thus, without knowing the correct IDE that OP is using, I reviewed the information at hand along with what experience I have in programing and selected an answer that could cover either a VB6 or earlier question or one that is possibly a dot-net starting with VS2005....
-
As for causing upset... it takes considerably more than a slight disagreement to upset me (well, provided I get a few hours of sleep :) )
Despite my age and knowledge; I am wise enough to understand that I do make mistakes.