|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
Transfer the data to another listview Hi, I am creating project in Visual basic where i need to transfer some selected items from one list view to another list view. When i double click on any item , an input box should get appear which should ask me for quantity which should be less then existing one. After clicking on OK button lesser quantity should display on other list view it computes the total amount of the price of the quantity. Can anyone help me out with this issue following is the code for my first view list. Code: Public Sub list() Dim lst1 as List_Item Dim x1 As Integer ListView1.List_Items.clear While Not rs.EOF Set lst = ListView1.List_Items.Add(, , rs(0)) For x = 1 To 4 lst.SubItems(x) = rs(x) Next x rs.MoveNext Wend End Sub |
#2
| |||
| |||
Re: Transfer the data to another listview Try to use below code and i am sure this would transfer data to another view list whose name as List_view2. Code: Private Sub ListView1_DblClick() Dim lst2 As List_Item Dim ip1 As String ip1 = InputBox("Enter the quantity to be lessen", "Quantity") With List_View1.SelectedItem .SubItems(3) = (.SubItems(3)) - Val(ip1) Set lst2 = List_View2.ListItems.Add(, , List_View1.SelectedItem) lst2.SubItems(1) = .SubItems(1) lst2.SubItems(2) = .SubItems(2) lst2.SubItems(3) = ip1 lst2.SubItems(4) = (Val(ip1)) * (.SubItems(4)) End With End Sub |
#3
| |||
| |||
Transfer the data to another listview Thank you Ektaa for replying me, it's working great, but over here I'm facing one more issue when i try to input greater amount of quantity it makes negative number on stocks. Can anyone tell me how can i make total all the value of price and if any stock has zero quantity then i should not be able to input values over there. |
#4
| |||
| |||
Re: Transfer the data to another listview If you want to have a code which if the stock is zero then it cannot input quantity and also how can you total all the value of price, then try to add following code Stock Quantity is Zero: Code: If List_view1.SelectedItem.SubItems(3) = 0 Then Msgbox "Stock Not Available" Exit Sub End If Code: If Val(ip1) > List_view1.SelectedItem.SubItems(3) Then Msgbox "Input value is greater then stock quantity" Exit Sub End If Code: Dim j as Integer Dim Total_Price as Currency For j = 1 to Listview1.List_Items.Count Total_Price = Total_Price + Val(Listview1.List_Items(i).SubItems(4).Text) DoEvents Next i Msgbox Total_Price |
![]() |
|
Tags: listview, transfer, visual basic |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to transfer data on LAN | Dumpkin | Networking & Security | 3 | 29-11-2010 06:09 PM |
How to transfer PS3 data to another PS3 | Marjorie | Video Games | 7 | 19-10-2010 05:40 PM |
What USB drive can do besides data transfer? | Agry | Hardware Peripherals | 3 | 08-09-2010 11:50 PM |
Want to delete the data using the ListView | Flaco | Software Development | 6 | 20-01-2010 05:42 PM |
Data transfer between 2 Blackberries | Japheth | Portable Devices | 3 | 02-05-2009 01:01 PM |