|
-
Jul 8th, 2003, 10:05 AM
#1
Thread Starter
New Member
list view question/problem **** Resolved *******
Hello I have a Form that has a bunch of controls a couple of textboxes, comboboxes and some cmd buttons with a listview
now what I am doing is gathering some user data via text boxes and combobox and I am giving the user the ability to add and remove these records into the list view only problem is one of those fields is a decimal field and I need to keep track of that number (that is not the problem) my problem is when the user
removes an item from the listview. I need to get the selected items .subitem and add it back to my running total I know you can go in and get the selected items from the listview however I just need the .subitems
Thanks
Last edited by vbnet20; Jul 8th, 2003 at 01:19 PM.
-
Jul 8th, 2003, 10:16 AM
#2
Fanatic Member
Dim lstItems As New ListViewItem()
lstItems = ListView1.SelectedItems(0)
MsgBox(lstItems.SubItems(0).Text)
MsgBox(lstItems.SubItems(1).Text)
-
Jul 8th, 2003, 01:04 PM
#3
Thread Starter
New Member
Okay listview Error specified arg was out of range of valid values
Here is the code
Private Sub Delete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Delete.Click
Dim a As Integer
Dim lstItems As New ListViewItem()
For a = ListView1.Items.Count - 1 To 1 Step -1
If ListView1.Items(a).Checked = True Then
ListView1.Items.RemoveAt(a)
'
lstItems = ListView1.SelectedItems(a)
MsgBox(lstItems.SubItems(0).Text)
MsgBox(lstItems.SubItems(1).Text)
End If
Next
AddItem.Enabled = True
ListView1.Enabled = True
tempmoney = 0
labelcapture = tempmoney + Val(Label12.Text)
AddItem.Enabled = True
cboAcctNum.Focus()
End Sub
Thanks
Last edited by vbnet20; Jul 8th, 2003 at 01:19 PM.
-
Jul 8th, 2003, 01:21 PM
#4
Thread Starter
New Member
figured it out Thanks
modified code
Private Sub Delete_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Delete.Click
Dim a As Integer
Dim lstItems As New ListViewItem()
For a = ListView1.Items.Count - 1 To 1 Step -1
If ListView1.Items(a).Checked = True Then
lstItems = ListView1.Items(a)
ListView1.Items.RemoveAt(a)
MsgBox(lstItems.SubItems(0).Text)
MsgBox(lstItems.SubItems(1).Text)
End If
Next
AddItem.Enabled = True
ListView1.Enabled = True
tempmoney = 0
labelcapture = tempmoney + Val(Label12.Text)
AddItem.Enabled = True
cboAcctNum.Focus()
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|