ListView Fundamentals :: C#
-
Okay. Thanks. I tried using SelectedItems, but it does not return the correct selected item. For example, it always return index 0 even if I select index 10. Kuphryn
Are you handling the SelectedIndexChanged event? And, since SelectedItems is a collection, did you access it like this:
myListView.SelectedItems[0]
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past. -Chris Maunder
-
Are you handling the SelectedIndexChanged event? And, since SelectedItems is a collection, did you access it like this:
myListView.SelectedItems[0]
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past. -Chris Maunder
-
Yes. I added a handler for SelectedIndexChanged event and checked SelectedItems[...]. However, for some reason item 0 is always selected even if I click on item 2002. Weird! Kuphryn
Actually, I just played around with it a bit, and you should handle the click event instead. Then do
myListView.SelectedItems[0]
. Oh, and you have to use 0 because that's the only item in the collection of selected items.
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past. -Chris Maunder
-
Actually, I just played around with it a bit, and you should handle the click event instead. Then do
myListView.SelectedItems[0]
. Oh, and you have to use 0 because that's the only item in the collection of selected items.
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past. -Chris Maunder
-
kuphryn wrote: Your solution works perfect! Cool! :cool: Glad I could help. Mind if I ask what your app does?
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past. -Chris Maunder
-
kuphryn wrote: Your solution works perfect! Cool! :cool: Glad I could help. Mind if I ask what your app does?
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past. -Chris Maunder
-
It is not an application. It is something I have to do for a school project. Thus, I do not consider it an application. Lets just say it is a "Hello World" instruction using C#. Thanks again, Kuphryn
Cool. Where do you go to school?
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past. -Chris Maunder Microsoft has reinvented the wheel, this time they made it round. -Peterchen on VS.NET
-
Cool. Where do you go to school?
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past. -Chris Maunder Microsoft has reinvented the wheel, this time they made it round. -Peterchen on VS.NET
-
I go to school in, lets just say, a school to a pretty bad Computer Science program. Oh, I guess you already see that via the fact that we even consider C#. Kuphryn
kuphryn wrote: Oh, I guess you already see that via the fact that we even consider C#. :wtf:What!?!?! That's a good school, IMO. Most schools won't even consider using these "bleeding edge" technologies. Are you in high school or college?
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past. -Chris Maunder Microsoft has reinvented the wheel, this time they made it round. -Peterchen on VS.NET
-
I go to school in, lets just say, a school to a pretty bad Computer Science program. Oh, I guess you already see that via the fact that we even consider C#. Kuphryn