473,473 Members | 2,153 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Listview, change index programically

Jax
Dear all,

I have a list view, i dont like this list view very much
anymore as it hasn't been the easiest object to use thus
far.
Now i like it even less.
I have a problem with it, I wish to change the selected
index (i set selected to 1 so it can only select one) but
it keeps telling me it is read only.
Surely there must be a way round this!?!?

If anyone knows please tell me or give me a clue :)
Thanks for any help given.

jax
Nov 15 '05 #1
5 5591
Hi Jax,

There's also SelectedIndexes collection on the ListView. I am not sure it
can be modified but you might also want to check out this one.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Jax" <an*******@discussions.microsoft.com> wrote in message
news:cf****************************@phx.gbl...
Dear all,

I have a list view, i dont like this list view very much
anymore as it hasn't been the easiest object to use thus
far.
Now i like it even less.
I have a problem with it, I wish to change the selected
index (i set selected to 1 so it can only select one) but
it keeps telling me it is read only.
Surely there must be a way round this!?!?

If anyone knows please tell me or give me a clue :)
Thanks for any help given.

jax


Nov 15 '05 #2
Nope it's read only as well, I already tried. :(
Anyone else got any ideas?

jax
-----Original Message-----
Hi Jax,

There's also SelectedIndexes collection on the ListView. I am not sure itcan be modified but you might also want to check out this one.
--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Jax" <an*******@discussions.microsoft.com> wrote in messagenews:cf****************************@phx.gbl...
Dear all,

I have a list view, i dont like this list view very much
anymore as it hasn't been the easiest object to use thus
far.
Now i like it even less.
I have a problem with it, I wish to change the selected
index (i set selected to 1 so it can only select one) but it keeps telling me it is read only.
Surely there must be a way round this!?!?

If anyone knows please tell me or give me a clue :)
Thanks for any help given.

jax


.

Nov 15 '05 #3
myListView.Items(someIndex).Selected = True
On Thu, 4 Dec 2003 08:09:17 -0800, "Jax"
<an*******@discussions.microsoft.com> wrote:
Dear all,

I have a list view, i dont like this list view very much
anymore as it hasn't been the easiest object to use thus
far.
Now i like it even less.
I have a problem with it, I wish to change the selected
index (i set selected to 1 so it can only select one) but
it keeps telling me it is read only.
Surely there must be a way round this!?!?

If anyone knows please tell me or give me a clue :)
Thanks for any help given.

jax


Nov 15 '05 #4
Hi,

You have to set to true the ListViewItem.Selected property:

ListView.Items[ index ].Selected = true;

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Jax" <an*******@discussions.microsoft.com> wrote in message
news:cf****************************@phx.gbl...
Dear all,

I have a list view, i dont like this list view very much
anymore as it hasn't been the easiest object to use thus
far.
Now i like it even less.
I have a problem with it, I wish to change the selected
index (i set selected to 1 so it can only select one) but
it keeps telling me it is read only.
Surely there must be a way round this!?!?

If anyone knows please tell me or give me a clue :)
Thanks for any help given.

jax

Nov 15 '05 #5
Jax
Thanks Todd and Ignacio!

Thats great and works fine!
Many more thanks
and some more
and another

:)
jax
-----Original Message-----
Dear all,

I have a list view, i dont like this list view very much
anymore as it hasn't been the easiest object to use thus
far.
Now i like it even less.
I have a problem with it, I wish to change the selected
index (i set selected to 1 so it can only select one) but
it keeps telling me it is read only.
Surely there must be a way round this!?!?

If anyone knows please tell me or give me a clue :)
Thanks for any help given.

jax
.

Nov 15 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: John Lauwers | last post by:
I know you can edit the first column of the listview control, is there a way to edit the second and/or the other columns? greets John
1
by: andrewcw | last post by:
The clcik event on the ListView control seems to trigger off the item level ( the first column ). I would like to be able to trap the click event on a particular subitem ( a specific column's row...
0
by: willow1480 | last post by:
I am developing a small little Service Control Application. I am using a listview control with checkboxes and getting the list of services I want to control from a text file. When you check a...
6
by: ReMEn | last post by:
I was wondering how I can use a listview effectively in managed c++ ..net. Basically I'm trying to get the index of the selected item in the list view, then get the "tag" attribute of that item to...
0
by: Terry Brown | last post by:
I have a form which contains a listview item. The form is created to view data that is generated by interaction with a separate form. There are buttons on the form that change the data source...
2
by: Ben H | last post by:
Hello all I'm using a listview in my app but I want to scroll the listview programatically as I hate the look of the standard scrollbar. So, the listview is scrolled programatically using...
10
by: Adam Honek | last post by:
This is probably a silly question but oh well, I can't find the answer looking via code. Having an imagelist already, how does one set an icon for a list view's sub items? I'm using the code...
5
by: Phill W. | last post by:
(VB'2003) What's the correct way to remove multiple, selected items from a ListView control (say, from a ContextMenu)? I ask because I'm getting a very annoying ArgumentOutOfRangeException...
1
by: plmanikandan | last post by:
Hi, I have a listview with items,subitems.I tems and subitems are added as below listView1.View = View.Details; listView1.Columns.Add("Column 1", 100,HorizontalAlignment.Center);...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.