.NET Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgramming.NET Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 16th, 2004, 06:22 AM
kelso kelso is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 1 kelso User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question listview position control

new to .net can't figure out how to
code a button to move item in a listview
to position before current position

Reply With Quote
  #2  
Old May 31st, 2004, 02:50 AM
mzim mzim is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 6 mzim User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally Posted by kelso
new to .net can't figure out how to
code a button to move item in a listview
to position before current position

what do you mean?
when you click a button an item in listview will move in another position?
is that what you mean?

Reply With Quote
  #3  
Old June 1st, 2004, 03:36 AM
topi topi is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: May 2004
Posts: 6 topi User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
hmm...

well that's also my problem...
assuming that there's already an items in the listview.
when i click the button1, it will transfer to the other position
but the problem is it will not remove the original position...
i try to put remove method but the item will insert to the first column

here the code to listview position to another but w/o removing it...
PrivateSub Button1_Click(ByVal sender AsObject, ByVal e As System.EventArgs) Handles Button1.Click

Dim str AsString

str = ListView1.Items(ListView1.Items.Count - 1).Text

ListView1.Items.Add(str)

EndSub



Reply With Quote
  #4  
Old June 12th, 2004, 02:20 AM
gasperCasper gasperCasper is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 3 gasperCasper User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I cud not understand neither kelso nor topi clearly..

but here is what I think you need:

you want to be able to remove items from listview. Right? I am assuming that you do not have problems adding items to listview but to remove the items.

if so, please read thru:
There is a property for listview called SelectedItems.

listView.SelectedItems will return a collection object of type listView.SelectedListViewItemCollection. You can iterate thru this collection object and delete one (or all) the selected items. I have some code for you below:
Code:
		Dim selCol As ListView.SelectedListViewItemCollection 'declare a collection object
		Dim selColItem As ListViewItem 'declare a listview item
		selCol = Me.ListView1.SelectedItems 'get all the items selected
		Dim idx As Integer 'index
		'iterate thru selected items and delete one after one
		'if there is only one selection then ONLY that item
		'will be deleted
		For Each selColItem In selCol
			Try
				idx = selColItem.Index 'get index (but not needed)
				selColItem.Remove() 'delete the selectedItem
			Catch ex As Exception
			End Try
		Next
'after deleting one or more items you can start adding new items


does that answer your question(s)?

_______________________
Web reading made easy-
http://www.xemantex.com

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgramming.NET Development > listview position control


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT