|
-
Dec 22nd, 2003, 08:39 AM
#1
Thread Starter
Member
eeek list view :@
i got 2 colums renamed them to lstpric lst name the list view alltogether is called listview1
so i did this code
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ListView1.Items.Add(txtnam.Text)
End Sub
that adds it to the lstname column how to make it add in the lst pric :/
cheers
-
Dec 23rd, 2003, 06:26 AM
#2
Thread Starter
Member
noone any other ideas :/
-
Dec 23rd, 2003, 06:28 AM
#3
Fanatic Member
-
Dec 23rd, 2003, 06:32 AM
#4
Thread Starter
Member
tahnk you and merry christmas n new year
-
Dec 23rd, 2003, 06:33 AM
#5
Fanatic Member
you too mate!
-
Dec 23rd, 2003, 07:02 AM
#6
Thread Starter
Member
that example works great but i cant seem to be getin another button to add up the ages :/ (or in my case prices) any code for that :/
VB Code:
Private Sub cmdcal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdcal.Click
counteritem = lstboxpric.Items.Count - 1
For counter = 0 To counteritem
myvar = lstboxpric.Items.Item(Int(counter))
If myvar = D Then
num = D
itotal = itotal + num
BVAT.Text = "£ " & itotal.ToString
End If
If myvar = V Then
num = V
itotal = itotal + num
BVAT.Text = Format(V, "##0.00").ToString
BVAT.Text = "£ " & itotal.ToString
End If
If myvar = P Then
num = P
itotal = itotal + num
BVAT.Text = Format(P, "##0.00").ToString
BVAT.Text = "£ " & itotal.ToString
End If
Next
itotal = 0
End Sub
i had that working but now i want to swich it to listview1 i want it to add the prices (where the age is in the example) any ideas :/
-
Dec 23rd, 2003, 07:36 AM
#7
Fanatic Member
Code:
Dim count As Integer
Dim sum As Integer
Dim lstItem As ListViewItem
For count = 0 To ListView1.Items.Count - 1
lstItem = ListView1.Items(count)
sum = sum + CInt(lstItem.SubItems(1).Text)
Next
TextBox1.Text = sum
this adds up the ages
-
Dec 23rd, 2003, 07:39 AM
#8
Fanatic Member
this works for the adding up as well
Code:
For count = 0 To ListView1.Items.Count - 1
sum = sum + ListView1.Items(count).SubItems(1).Text
Next
-
Dec 23rd, 2003, 08:59 AM
#9
Thread Starter
Member
VB Code:
Private Sub CMDcalc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CMDcalc.Click
Dim count As Integer
Dim sum As Double
Dim lstItem As ListViewItem
For count = 0 To ListView1.Items.Count - 1
lstItem = ListView1.Items(count)
sum = sum + (lstItem.SubItems(1).Text)
Next
BVAT.Text = sum
End Sub
im using that it works great cheers
how can i format bvat.text so it shows only 2 decimal cuz 3.25 + 3.25 = 6.50 but in bvat.text it showed up as 6.5 :/
-
Dec 23rd, 2003, 09:18 AM
#10
Fanatic Member
textbox1.text = format(sum, "#0.00")
-
Dec 23rd, 2003, 09:28 AM
#11
Thread Starter
Member
ONE LAST THING, how can i change a price in listview i no how to do it for listbox it wont work though
-
Dec 23rd, 2003, 05:26 PM
#12
Thread Starter
Member
no one at all
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
|