Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Dragging Listview From One Form To Another Form..


How to drag Listview Item to another form with the same format of Listview. not a Listitems???? hElp please??




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Dragging A Form
Hi all,

I have created a form that pops up and follows the curser around the screen when you are dragging an item from one list to another. This works with a timer on the form that repeatedly repositions the form next to the curser using the GetCursorPos function. I have a text box on this form that I want the user to be able to type in whilst dragging an item. If the moue button is not held down (and the form is just following the cursor), the text box accepts text quite happily, but when the mouse is held down as you are dragging an item, te text box does not accept text any more!?
I have tried using the GetKeyState function in the timer loop combined with a loop to go through the ascii key codes, to place letters that are pressed after the existing text in the box, but that doesnt account for the other keys on the keyboard such as the curser keys, delete, backspace, etc.

Does anybody have any suggestions on how I can make the text box accept input while the mouse button is pressed and dragging?

Any help would be great

Thanks in advance, Al.

Dragging The Form
I have a form with no border. Is there a way to drag the form and move it around the screen without having the title bar to click on? thanks

Form Dragging
Ok my form is useing a graphic image over the form but im having a problem dragging the form, I keep getting Compile err0r: Sub or Function not defined.


Code:
Private Sub Label3_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Drag Me
End Sub

Help

Dragging A Form
Hi all,

I have created a form that pops up and follows the curser around the screen when you are dragging an item from one list to another. This works with a timer on the form that repeatedly repositions the form next to the curser using the GetCursorPos function. I have a text box on this form that I want the user to be able to type in whilst dragging an item. If the moue button is not held down (and the form is just following the cursor), the text box accepts text quite happily, but when the mouse is held down as you are dragging an item, te text box does not accept text any more!?
I have tried using the GetKeyState function in the timer loop combined with a loop to go through the ascii key codes, to place letters that are pressed after the existing text in the box, but that doesnt account for the other keys on the keyboard such as the curser keys, delete, backspace, etc.

Does anybody have any suggestions on how I can make the text box accept input while the mouse button is pressed and dragging?

Any help would be great

Thanks in advance, Al.

Dragging Out Of My Form
Hi, I'm using drag/drop to remove certain objects from my form. I got most of it working so far.. I can drag an item over a certain object and it removes this object from the form. But i want to be able to drag the item outside the form and have it get removed as well. Any idea's?

Form Dragging
Ok, i have 3 forms, and my form1 is my main form, and what i want is that whenever the main form is dragged and moved around then the 2 other forms will move along with it.

So far i have this, but it will only work when you click on the back of the form, which i dont want as i want it to happen when you click the caption bar thing.


VB Code:
Private Done as Boolean Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)    If Button = vbLeftButton Then        Done = True    End IfEnd Sub Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)    If Button = vbLeftButton Then        Done = False    End IfEnd Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)'Snapping    If Done = True Then        If frmMulti.SnapPlaylist.Value = 1 Then            frmPlaylist.Top = Me.Top            frmPlaylist.Left = Me.Left + Me.Width        End If        If frmMulti.SnapExtra.Value = 1 Then            frmMulti.Left = Me.Left            frmMulti.Top = Me.Top + Me.Height        End If    End IfEnd Sub

Dragging The Form
Code:
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long


Code:
Private Declare Function ReleaseCapture Lib "user32" () As Long



Code:
Private Const WM_MOVE = &HF012


Code:
Private Const WM_SYSCOMMAND = &H112



Code:
Sub MoveTheForm(NameOfForm As Form)


Code:
Call ReleaseCapture


Code:
Call SendMessage(NameOfForm.hwnd, WM_SYSCOMMAND, WM_MOVE, 0)


Code:
End Sub


I'm trying to make it so the user can drag the form when he clicks anywhere on the form. However, the code is not working!! I'm using the above declerations and then calling it like this:

Private Sub Form_Click()
Call MoveTheForm(Form1)
End Sub

however, this is not doing anything!! What's wrong??

Dragging The Form
is there a message or something the program receives while the window is being dragged across the screen?

i want to be able to make another form 'stick' to the bottom of this form, but i don't know how to find out if the form is being dragged.

Dragging Controls Around A Form
I have an array of shape controls on my form. At runtime, I would like the user to be able to freely drag and drop the shapes around the form using their mouse.

I was thinking that this might be something to do with Shape1_DragDrop event, but I've not managed to get this to work.

Does anyone have any ideas?

Dragging A Frame Onto A Form
Hello people,
Maybe a trivial question, but I have some problems in doing that:
Simply I need to drag a frame on a surface occupied by a FlexGrid (fg). The only thing I need is this:
Ckick on the frame, drag it to another position of the fg and drop there.
I have set this code:

Private Sub Frame2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Frame2.DragMode = vbManual
m_intX = X
m_intY = Y
Frame2.Drag vbBeginDrag

Private Sub fg_DragOver(Source As Control, X As Single, Y As Single, State As Integer)
Frame2.Move X - m_intX, Y - m_intY
End Sub

Indeed the thing works, but only if the mouse pointer is not dragged on the frame itself. It is not so easy to explain, therefore please give me a suggestion to do that better.

Thank You to Everyone
Regards

TdP

Dragging Controls In A Form
This is what I would like to accomplish: I am dragging an image that will drop somewhere in the form. This is what's in my code:


VB Code:
Private LeftofImage1 As LongPrivate TopofImage1 As LongPrivate inmovement As Boolean Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)    LeftofImage1 = X    TopofImage1 = Y    inmovement = TrueEnd Sub  Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)    If inmovement = True Then      Image1.Top = Image1.Top - (TopofImage1 - Y)      Image1.Left = Image1.Left - (LeftofImage1 - X)    End IfEnd Sub Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)    inmovement = FalseEnd Sub


LeftofImage1 and TopofImage1 are the X and Y values of my image control before dragging, and inmovement checks whether or not it's still MouseDown.

Just to clairify, the image flickers to the opposite direction of where I want to go. Does anybody know how to fix this?

Form Dragging Event?
Is there any way to detect when the Form is being dragged?
I need some sort of event that fires continously when the form is being dragged, I mean like someone Mouse_Down in the titlebar and move the Form.
Some sort of Form_Resize event, but for dragging.

If I Add An Item Onto A Form, How Do I Go About Dragging It Around?
I been searching on these forums but cant find anything using VB 6

Prob On Dragging A Form
hello
i'm using a child form and wen i'm writing a code to drag a form on to the parent form its not working.
can anybody suggest a small example which is having a code related to form dragging
thnks

Dragging FrmSplash Form
Using VB 6.0 I added a form frmSplash in my project. I want to drag it with mose on runtime. How?

Dragging A Borderless Form
I have a form with BorderStyle 0 - How can I drag it and reposition it on the desktop?

Dragging Image On Form W/ Layers
Hello all. I've created a program that allows the user to drag pictures from one form to another, and also anywhere within a form. If the user is dragging the picturebox within the same form, the picture moves with the cursor (it doesn't just appear at the new cursor position when the drag is complete). I've used the BitBlt API to accomplish some of my program.

My problem: Along with what I currently have I would like one form to have multiple layers. I would like a user to be able to click on a picture and be able to type what layer to move it to in a textbox (say 1-10), or use arrows to move it a layer up or down, or some sort of system. Annnnyway, any suggestions of how to accomplish this?

Thanx

Stop Form From Dragging Off-Screen
I've searched this quite a bit and keep coming up with the same results... all of which don't really solve the problem...

I have a form that I want users to drag, however, I do not want the form to cross the edges of the screen. That is, I do not want any part of the form to disappear outside the screen. The only code I've found close to this is one to snap the form to the edge of the screen (while still allowing it to be pushed outside the screen).

I've tried using the mouse position API for the form, but it doesn't capture the X and Y coordinates for when you're over the form's border. I understand this to only see the INSIDE of the form, and not the form's border included.

Thanks in advance!

How Can I Move A Form By Clicking On It And Dragging It
Hi, Is there any way I can drag a from across my screen by clicking on it and dragging. There is no blue bar at the top and I dont want to have one (for cosmetic purposes).

Thanks in advance if you can help,

John

Dragging A Command Button Around The Form
Hi everyone, i am extremely new to VB and dont know very much at all, and i need a bit of help

I want to make an extremely simple program which has one command button on a form, i want to be able to drag the command button around the form and drop it into a new position.

This is what I have so far (bearing in mind that im not sure if this is correct)

Code:
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
          command1.drag vbbegindrag
end sub


And i want to know what i have to do to make the button change its position on the form depending on where you drop it, i think it is something to do with 'Command1_DragDrop' but am not sure

please try to keep it simple, im a newby

Move A Form In Win NT By Dragging The File
I am using the following code in mousemove event of a form

ReleaseCapture
Call SendMessage(me.hwnd, &H112, &HF012, 0)




This works fine and the form moves in win98 but the form doesent move at all in win NT 4. I havent tried it with other os.
Any one knows why and whats the workaround?

Thanks in advance.
-Sanjay
Sanjaykattimani@hotmail.com


-Sanjay kattimani

MScomm Troubles Dragging Non Modal Form
I experienced this problem:
If I use a MScomm control receiving a continous stream of data from a serial port and I open and drag a non modal window the operating system crash after few seconds of operation.
Anybody experienced the same?
Have someone any hints or ideas to workaround the problem?

To duplicate the effect:

1. create a new project.
2. Add a form as Form2
3. on Form1 * * * three buttons "startcom", "stopcom", "newform"
4. add a MScomm1.ocx control
5. add a label1 and edit its caption = "0"
5. Paste the below code

note: The Startcom button open the comm port 1 at 38400 (but also different baud rate generates the same problem).
The Stopcom button stop the communications

6. Run the program
7. If you click on startcom the label1 begins to count the commevent
if you click on stopcom the label1 stops to count

8. If you click on newform a new form (form2) not modal will be opened
9. If the comm port is closed you can drag the form and continue
to drag it for an indefinite period of time around the desktop
10. if you open the comm and open a newform and drag it
for a while; the software will continue to process the oncomm events
but soon all the system will crash...

Any ideas???
Thank you!

Code:::

Private Sub startcom_Click()
MSComm1.Settings = "38400,n,8,1"
MSComm1.CommPort = 1
MSComm1.PortOpen = True
End Sub

Private Sub stopcom_Click()
MSComm1.PortOpen = False
End Sub

Private Sub newform_Click()
Form2.Show 0
End Sub

Private Sub MSComm1_OnComm()
a$ = MSComm1.Input
Label1.Caption = Val(Label1.Caption) + 1
End Sub

MDI Child Form Auto Scroll When Dragging
Here is my problem :

I have a couple of pictureboxes in an MDI child form that is bigger than its parent MDI form.
All pictures can be dragged from one box to another.
But because not all the pictureboxes are visible ( unless you scroll the MDI form ), it is impossible to drag let say Picture1 into Picture10 because Picture10 is not accessible.
Is there a way on drag event to make the MDI Form scroll automatically when it hits the borders of the form ?
Thanx !

Finding Out If The Form Itself Is Being Moved By Dragging On The Title Bar... ?
Hello ppl...

I'm using windows 2000's layering abilities to make my form semi-transparent when a user drags it around and make it opaque when the mouse button is released. The problem is that I can't find a way to check if the form is being dragged around. The mouse events of the form do not fire when the title bar is being dragged. All i want is a mechanism that tells me if the title bar is being dragged or not. Can anyone help me?

Asim

Dragging Form / Slider Etc. Stops Execution
My code needs to transmit regular packets onto a serial bus, however when the user holds the mouse down on a slider etc. then the transmit function stops until they let go

Is there a clever way to continue processing whilst this is happening?

I am thinking multithreading might be a way around this problem but is there a simpler way?

Cheers

ListView DRAGGING
How can I select multiple items by clicking and then dragging over the amount of records that are there?

thanks...

Listview - Turning Off Dragging
I'm in one of my old apps and noticed that for some reason I used a listview control when a listbox "might" have done the job. My comments aren't as good as they should be (lesson learned). Anyway, since I'm not sure why I used a listview instead of a listbox I'm not willing to replace it. I don't have the time.

So... Is there a property (that I can't find) that turns off dragging of items in the listview control?

Thanks,
Bernie

Dragging And Dropping From One Listview To Another
Hi all,

How can I drag and drop multiple items including their subitems from one listview to another. Please help.

Thanks,
Nitesh

Dragging Listview Items
How to drag Listview Item to another form with the same format of Listview.??? hElp please??

Listview Dragging Item
Hello, Jusk asking if there is a possible way to drag item in the listview??

it goes like this:

Listview populate with;

Item 1
Item 2
Item 3

When I drag Item 3 to the position of Item2, it goes like this;

Item 1
Item 3
Item 2


is this possible?? if not?? what should I do??

Listview Icons And Dragging
Is it possible to have the listview Items containing icons not able to drag? If so how?

ListView And Turning Off Dragging
I have Listview with a number of items and I want a user to be able to select an item by clicking on it. Currently, if they click and drag then the icon and text go flying all over the window. How do you keep them from being able to click and drag on the icons messing up the entire list view but still allow them to click and select one? There are a number of related posts but noone seems to have a straightforward answer and this seems easy. Help please!

Thanks.

Create Shortcut By Dragging From Listview
Was wondering if someone could show me an example of creating a windows shortcut by dragging an item out of a listview control and say onto the desktop.

When creating the shortcut I would like to link to a specifix .exe, but use what was dragged out as part of the command line parameters.

Thanks in advance

Listview: Disabling User Dragging
Is there a way to disable the user from dragging items in a listview. My listview.view=lvwIcon and has to stay that way (e.g. I need the nice large icons)

Thanks in advance,

Listview Setting No Column Dragging
Hi all
you know how with the listview columns you can drag them?
howdo i stop this or get it to resize as soon as the user drags it so its kind of asking howto set the drag to be undraggable


Tom

Dragging Multiple Items From A Listview
i have some code to let users drag an item from a listview onto a treeview node, which works fine, but now i want to let them drag multiple items.

the problem is that when then select a bunch of items, then drag them to the treeview, it leaves only the last item they clicked on selected (as if they selected them, then just left-clicked one of them). is there a way to keep them all selected?

also, just out of interest, is there a way to make the drag icon include some text from each selected listview item along with an icon (like when you drag multiple files in windows explorer)?

thanks for any help

Problem With ListView Control And Dragging
I'm trying to drag an item from one ListView control to another but whenever I click on any of the items the first item is selected no matter which I have clicked on. The drag outline does appear over the selected object though. The ListView control is in report view and all the other relevant code is below, can anyone suggest what I've done wrong?

Many thanks
Geoff

Setting up control:
Dim itmX As ListItem

lsvEvents.ListItems.Clear
lsvEvents.ColumnHeaders.Clear
lsvEvents.ColumnHeaders.Add , "Event", "Event", lsvEvents.Width / 2
lsvEvents.ColumnHeaders.Add , "Time", "Time", lsvEvents.Width / 2
lsvEvents.SmallIcons = imlLog

For each record in a recordset:
Set itmX = lsvEvents.ListItems.Add()
itmX.Text = !Name
itmX.Tag = !EventID
itmX.SubItems(1) = !OpenTime

Select Case !EventType
Case Is = "<Project File>"
itmX.SmallIcon = "Project"
Case Is = "<Resource File>"
itmX.SmallIcon = "Resource"
Case Is = "<Issue>"
itmX.SmallIcon = "Issue"
End Select

MouseDown:
Private Sub lstEvents_MouseDown(Button As Integer, Shift As Integer, x As
Single, y As Single)
Dim DY ' Declare variable.



DY = TextHeight("A") ' Get height of one line.
lblDrag.Move lstEvents.Left, lstEvents.Top + y - DY / 2, lstEvents.Width,
DY
lblDrag.Drag ' Drag label outline.
End Sub

Problem With ListView Control And Dragging
I'm trying to drag an item from one ListView control to another but whenever I click on any of the items the first item is selected no matter which I
have clicked on. The drag outline does appear over the selected object though. The ListView control is in report view and all the other relevant code is below, can anyone suggest what I've done wrong?

Many thanks
Geoff

Setting up control:
    Dim itmX As ListItem

    lsvEvents.ListItems.Clear
    lsvEvents.ColumnHeaders.Clear
    lsvEvents.ColumnHeaders.Add , "Event", "Event", lsvEvents.Width / 2
    lsvEvents.ColumnHeaders.Add , "Time", "Time", lsvEvents.Width / 2
    lsvEvents.SmallIcons = imlLog

For each record in a recordset:
                    Set itmX = lsvEvents.ListItems.Add()
                    itmX.Text = !Name
                    itmX.Tag = !EventID
                    itmX.SubItems(1) = !OpenTime

                    Select Case !EventType
                        Case Is = "<Project File>"
                            itmX.SmallIcon = "Project"
                        Case Is = "<Resource File>"
                            itmX.SmallIcon = "Resource"
                        Case Is = "<Issue>"
                            itmX.SmallIcon = "Issue"
                    End Select

MouseDown:
Private Sub lstEvents_MouseDown(Button As Integer, Shift As Integer, x As
Single, y As Single)
   Dim DY ' Declare variable.
   
   
   
   DY = TextHeight("A") ' Get height of one line.
   lblDrag.Move lstEvents.Left, lstEvents.Top + y - DY / 2, lstEvents.Width,
DY
   lblDrag.Drag ' Drag label outline.
End Sub

Stop Item Dragging/moving In ListView
Is there any way you can stop the user from moving the item position in a listview?? I need them to stay the same as i added them first by code, with them being fixed for the user and not allowing any movement of item position!

thanks!

Disable Dragging Items In A Listview Control. Help, Help, Help
I don't know how to disable dragging items in a listview control. Please help me. thank you very much

Please Double Check This Dragging From ListBox To ListView Code For Me
I want to drag an item from a listbox to a listview so starting with my lisbox code:

Private DragID As Integer
Private blnAmDragging As Boolean


Code:
Private Sub lstUnalloc_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbLeftButton Then
DragID = lstUnalloc.ItemData(lstUnalloc.ListIndex)
End If
End Sub



Code:
Private Sub lstUnalloc_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
On Error GoTo errh

If Button = vbLeftButton Then
If lstUnalloc.ListIndex >= 0 Then
blnAmDragging = True
lstUnalloc.Drag vbBeginDrag
End If

End If

Exit Sub

errh:
errmsg "The following Exception occured : " & Err.Description & ", " & Err.Source & "", "Exception occured in frmMain.lstUnalloc_MouseMove ()"

End Sub


and now my listview:

Code:
Private Sub lvwPeople_DragOver(Source As Control, x As Single, y As Single, State As Integer)

On Error GoTo errh

If blnAmDragging = True Then
If State = vbLeave Then
Set lvwPeople.DropHighlight = Nothing
Else
Set lvwPeople.DropHighlight = lvwPeople.HitTest(x, y)
End If
End If

Exit Sub

errh:
errmsg "The following Exception occured : " & Err.Description & ", " & Err.Source & "", "Exception occured in frmMain.lstlist_DragOver()"

End Sub



Code:
Private Sub lvwPeople_DragDrop(Source As Control, x As Single, y As Single)

If Source = "lvwPeople" Then
Exit Sub
End If

Source.Drag vbEndDrag

Set lvwPeople.SelectedItem = lvwPeople.HitTest(x, y)

MsgBox lvwPeople.SelectedItem.Key
MsgBox DragID

End Sub


I just put 2 msgboxes to test. I have to write sql statements to assign the number to a person. I just need someone to check if I am doing the correct stuff for dragging and dropping.

I Hv Put Window Media Player In Its Own Form...and Try To Access It Form Anotehr Form???
my concept is put window media player into its own form...then i would like to access its from my other form....
for example, i hv 10 form.......i create new form which named is frm11, then i drap window media player from toolbox into frm11.....
then in each of my form(frm1 to frm10) have a button which named"movie"...
and i would like frm1 to frm10 access to frm11's window medai player to play movie clip .for example"dog movie" because each form movie clip is difference.....for example frm3 is cat movie clip...frm 8 is snake,,,,,etc

the reason i would like to put windox media player into frm11 only is becauce i if i attach wmp in each form...my program sleed will be affectd....

thansk for teach me how to slove it...
thanks !!!.

Form, Msg Box And Listview
I have field "tarikh_mula", "tarikh_tamat","peruntukan" "Aktiviti" in my listview. When I double click the items at listview, the message box appear as show me the record for field "aktiviti".

I want to show like that using combo box or form.It is possible?any idea?

Tarikh_mula :
Tarikh_tamat:
Peruntukan:
Aktiviti:


Code:

Private Sub lvJadual_DblClick()
MsgBox iItem, vbOKOnly, "Aktiviti " & sTarikh

End Sub




Code:
Private Sub lvJadual_ItemClick(ByVal Item As MSComctlLib.ListItem)

rec.MoveFirst
rec.Move CLng(Item.Index - 1)
iItem = rec("aktiviti")
sTarikh = Item.Text
getID = rec("id")
End Sub







Code:
Private Sub lvJadual_ItemClick(ByVal Item As MSComctlLib.ListItem)
'On Error Resume Next
rec.MoveFirst
'cLng() tu untuk convert nilai ke long integer
rec.Move CLng(Item.Index - 1)
iItem = rec("aktiviti")
sTarikh = Item.Text
'getID tu variable untuk simpan id daripd db
'rec("id") tu field yang dibaca dpd table kerja iaitu field id
getID = rec("id")
End Sub

ListView In A New Form?
I have a CommonDial a user uses to select a DB, I want a new form to open containing the ListView populated by the users selected DB. Also how do I send a form a variable. Can I change a forms properties and controls from a different form(like changes options Napster). Thanks for any input on the subject. Please suggest any tutorials as well.

ListView To Another Form
I have two forms. The main form is a data entry form. The second form is a search form with a listview that displays the results.
On the search form, when the user clicks the record he wants to go to. I want that record to be displayed on the main data entry form. I need the code to do this.

Get ListView Items From Another Form!
Assume that there are 2 Forms - frm1 & frm2. When a CommandButton is clicked in frm1, frm2 gets loaded. frm2 has a ListView where in users can add items (which they will have to type in a TextBox) by clicking an Add CommandButton. Items can also be deleted from the ListView by clicking a Remove CommandButton.

What I want is as & when the contents of the ListView changes & frm2 is unloaded, the change in contents in the ListView should be available to frm1. So for e.g. if the ListView has the following 3 items

India
Japan
China

& the user removes Japan from the ListView & then unloads frm2, a MsgBox in frm1 should display India & China. Since I want the change in contents of the ListView to be read when frm2 unloads i.e. when frm1 gets activated, I am coding the MsgBox in frm1's Form_Activate event function:
VB Code:
Private Sub Form_Activate()    Dim i As Integer    For i=1 To frm2.ListView1.ListItems.Count        MsgBox frm2.ListView1.ListItems(i).Text    NextEnd Sub
But the MsgBox doesn't display the correct items when frm2 gets unloaded.

Assume I remove Japan from the ListView. When frm2 unloads, the MsgBox in frm1 still displays the items as India, Japan & China where as I want the MsgBox to display only India & China since I have already deleted Japan from the ListView in frm2.

Where am I erring?

Treeview To Listview On Another Form..
Well I found out the best way for me to do this...


Code:
Private Sub Command1_Click()

Dim ListCount As Integer
Dim tvText As String
Dim tvKey As String
Dim Sum As Long
Dim i As Long
Dim ListItem1 As ListItem
Dim k As Integer
Dim lTot As Long
'Fix it so that when no Item is selected and you sellect show and addd to list no crash vbnullstring
'from db
If txtfields(2) = vbNullString Then
MsgBox "Please select an item first!", vbCritical
Exit Sub
End If

tvText = TV.SelectedItem.Text
tvKey = TV.SelectedItem.Key

If TV.Nodes(TV.SelectedItem.Index).Index > 0 Then
With frmList.ListView1
Set ListItem1 = .ListItems.Add(, , tvText)
ListItem1.SubItems(1) = rs.Fields("OrderNo")
ListItem1.SubItems(2) = rs.Fields("Description")
ListItem1.SubItems(3) = rs.Fields("ListPrice")
ListItem1.SubItems(4) = rs.Fields("DiscSchedule")

For k = 1 To .ListItems.Count
Set ListItem1 = .ListItems(k)
lTot = lTot + Val(ListItem1.SubItems(3))
Next
frmList.Text1.Text = FormatCurrency(lTot)
frmList.Text2.Text = .ListItems.Count

End With
End If

Command1.Caption = "Add to List"
Command2.Visible = True

End Sub


I am sure this was easy for some of you.. I am a newbie at Listview... Thnaks to all that responded....

Listview Populate From Another Form?
How do I populate a listview from another form? The form with the listview has a sub called 'PopulateListView' and is an MDI child. I tried calling the sub from another form with: frmName.PopulateListView, which works, but opens the form if it's not open.

I've been fiddling with this for a long time, so any help appreciated.

Ta.

Copyright © 2005-08 www.BigResource.com, All rights reserved