Pease please help.. with visual basic 2008. I am trying to get ListView to work but it does not for me.
I already set up ListView with 3 colums, but the coding is not working first column called ITEMS, second Quantity and 3rd is PRICE. All items are on Buttons and by clicking on any of them, should show the item name in 1st column,the quantity in the 2nd column which defined by how many clicks. Then the 3rd column should show the price of the item. One item has a choice of small or large then it will give us the price and other item has no choices, by cliking on the item button should give us the price. Finaly how to Total the price at the bottom of Listview. Please help I have been trying to figuer this out but my codes do not add up.
Midar01 0 Newbie Poster
morconnect 0 Newbie Poster
Hi,can you post your code so that we see where the errors where made and try troubleshooting!
Midar01 0 Newbie Poster
Thanks a lot for your respond. This is what I have done so far.
Public Class Form1
Dim A As ListViewItem
Dim temp As Integer
Public clicks As Integer
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Timer1.enabled = True
Timer1.interval = 1
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Label1.Text = TimeOfDay
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
'============================================================================
'This is where i want to click on button KIK and should give me an option of SMALL and LARGE instead of YES NO
'============================================================================
If MessageBox.Show("KIK", "KIK", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = Windows.Forms.DialogResult.Yes Then
A = ListView1.Items.Add("KIK")
'for the Qty subitems do not know what to use to add up the quantity number by clicking on the Item Button, instead of using ("1")
A.SubItems.Add("1")
A.SubItems.Add(45.0)
End If
'============================================================================
'How to get the total price of item sold. I have tried this but did not working
'============================================================================
Dim Qty As Double
Dim Item As String
Dim Price As Double
Item = InputBox("Which Item do you want to sale", "KIK", 0)
Qty = InputBox(" " & Item, "KIK", 0)
Price = InputBox(" " & Qty & " pcs of " & Item, "KIK", 0)
MsgBox "You bill is " & Chr(13) & Item & " " & Qty & " x " & Price & Chr(13) & _" " & Round(Qty * Price), vbOKOnly, "Sales")
End Sub
'===================================================================================
'There is no need for the option of SMALL and LARGE for these items LAC and GREEN. Just by one click it should give us the quantity. I do not know how to add that option of clicking on buttons and the quantity should add up instead of the repeatetion
'==================================================================================
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
A = ListView1.Items.Add("LAC")
A.SubItems.Add("1")
A.SubItems.Add(35.0)
Dim Qty As Double
Dim Item As String
Dim Price As Double
Item = InputBox(" ", "LAC", 0)
Qty = InputBox(" " & Item, "LAC", 0)
Price = InputBox(" " & Qty & " pcs of " & Item, "LAC", 0)
MsgBox "You bill is " & Chr(13) & Item & " " & Qty & " x " & Price & Chr(13) & _" " & Round(Qty * Price), vbOKOnly, "Sales")
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
A = ListView1.Items.Add("GREEN")
A.SubItems.Add("1")
A.SubItems.Add(40.0)
Dim Qty As Double
Dim Item As String
Dim Price As Double
Item = InputBox(" ", "GREEN", 0)
Qty = InputBox(" " & Item, "GREEN", 0)
Price = InputBox(" " & Qty & " pcs of " & Item, "GREEN", 0)
MsgBox "You bill is " & Chr(13) & Item & " " & Qty & " x " & Price & Chr(13) & _" " & Round(Qty * Price), vbOKOnly, "Sales")
End Sub
'==============================================================================
' When I click the Button Clear, it clears even the titles on listview(Items, Qty, Price)is there away of clearing just order instead of everything.
'===============================================================================
Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
ListView1.Clear()
End Sub
End Class
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.