| | |
ListView Small Probs
Please support our VB.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
•
•
Join Date: Apr 2009
Posts: 33
Reputation:
Solved Threads: 1
ListView Properties- I set MultiSelect to False, LabelEdit to true,FullRowSelect to True. I have Listview with two columns.
1) When I select onw row in listview,On button click i want to get the index of selected row. I m getting it but using for loop,I want to know is there a way to know the index of selected row,Without using the for loop.
2) On Listview, double click,i want to edit the items of listview.
When we double click on first row, 1 comes to edit mode, i want to know i want that second column text comes to edit mode..
So i write
But Error is there- InvalidArgument=Value of '1' is not valid for 'index'.
Parameter name: index
Can somebody tell me how to edit the second column text.
1) When I select onw row in listview,On button click i want to get the index of selected row. I m getting it but using for loop,I want to know is there a way to know the index of selected row,Without using the for loop.
VB.NET Syntax (Toggle Plain Text)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim lCount As Integer If ListView1.SelectedItems.Count > 0 Then For lCount = 0 To ListView1.Items.Count - 1 If ListView1.Items(lCount).Selected Then MsgBox(lCount.ToString) End If Application.DoEvents() Next End If End Sub
2) On Listview, double click,i want to edit the items of listview.
VB.NET Syntax (Toggle Plain Text)
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim lCount As Integer Dim lvitem As ListViewItem For lCount = 1 To 3 lvitem = ListView1.Items.Add(lCount) lvitem.SubItems.Add("ritu" & lCount) Application.DoEvents() Next End Sub Private Sub ListView1_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ListView1.MouseDoubleClick ListView1.SelectedItems(0).BeginEdit() End Sub
When we double click on first row, 1 comes to edit mode, i want to know i want that second column text comes to edit mode..
So i write
VB.NET Syntax (Toggle Plain Text)
ListView1.SelectedItems(1).BeginEdit()
But Error is there- InvalidArgument=Value of '1' is not valid for 'index'.
Parameter name: index
Can somebody tell me how to edit the second column text.
•
•
Join Date: Jun 2009
Posts: 225
Reputation:
Solved Threads: 39
ListView1.SelectedItems(1).BeginEdit() cant worrk out. You have multiselect set to false so there is always only one item selected. so it have to stick on 0.remember ListView1.SelectedItems(1) doesnt mean its the next item in list, its the next selected item (which doesnt exist on multiselect=False)
•
•
Join Date: Jun 2009
Posts: 132
Reputation:
Solved Threads: 13
1) since multiselect is false
listview1.selecteditems(1) is not possible
it has to be listview1.selecteditem(0)
since u want a particular column add another parameter.
listview1.selecteditem(0)(1)
this should fetch the second row.
this is just like a 2 dimensional array or a matrix.
first parameter is the row and the second parameter is the column
listview1.selecteditems(1) is not possible
it has to be listview1.selecteditem(0)
since u want a particular column add another parameter.
listview1.selecteditem(0)(1)
this should fetch the second row.
this is just like a 2 dimensional array or a matrix.
first parameter is the row and the second parameter is the column
![]() |
Similar Threads
- Horizontal scrolling for Listview (C#)
- Treeview + Small Probs (VB.NET)
- Problems instering items into a listview (VB.NET)
- Large Icon ListView like with Text area (Visual Basic 4 / 5 / 6)
- How to overcoming a .NET ListView CheckBoxes quirk (VB.NET)
Other Threads in the VB.NET Forum
- Previous Thread: syntax error in INSERT INTO statement
- Next Thread: Passing unicode query string to popup window using window.open method
| Thread Tools | Search this Thread |
"crystal .net .net2005 30minutes 2005 2008 access account arithmetic array assignment basic box button buttons center check code component connectionstring convert crystalreport data database databasesearch datagrid datagridview date design dissertation dissertations dissertationthesis dosconsolevb.net dropdownlist excel fade file-dialog firewall folder ftp generatetags hardcopy image images input insert intel isnumericfuntioncall math monitor ms navigate net networking opacity output passingparameters peertopeervideostreaming picturebox picturebox1 port problem problemwithinstallation project reports" savedialog searchvb.net select serial shutdown string survey tcp temp temperature text textbox timer toolbox trim updown user useraccounts usercontrol vb vb.net vb.netcode vb.netformclosing()eventpictureboxmessagebox vb.nettoolboxvisualbasic2008sidebar vb2008 vbnet view visual visualbasic visualbasic.net visualstudio visualstudio2008 web winforms wpf





