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




Moving In A Listview


a) I pass the number of item in a listview to a variable
irecordcount = ListView4.ListItems.Count

b) I (i suppose) set the view to the first item
ListView4.ListItems(ListView4.SelectedItem.Index + 0).Selected = True 'Posicionar en el registro 0
c) In that position a call a routine to save the data
Call DetalleSuscripcionDireccion(txtsuscripcion, Me)
d) the i move to the next item in the view
ListView4.ListItems(ListView4.SelectedItem.Index + 1).Selected = True ' Avanzar

i do a loop from 1 to the number of item in the view.

WHY it is not moving?
What i am doing wrong?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Moving A Listview Item And Its Subitems To A New Listview
Hey Guys,

Having a bit of trouble. I am attemping to move a selected item and its subitems from one listview to another. I have no problem getting the contents of the first column, but I can't seem to get the subitems over.

Example: I have this in the first listview:

Code:
|Item |Quanity|Price |PQ |
Bananas 2 $.50 $1.00

Then when I try to move that whole row to the other listview I can only seem to get this:

Code:
|Item |Quanity|Price |PQ |
Bananas

No subitems . Any links or help would be appreciated.

Regards,

Max_Power

Moving Through A Listview
Hi!

Does anyone have any idea for coding, to move through a listview (it's in Report Mode). I essentially need to know the statments for:

a) set listview to the 1st item (anything like ListView1.BOF?)
b) move to next listitem
c) do until Listview is at the end (anything like ListView1.EOF?

Any Ideas?

I'm trying to loop through a listview, to check for values. So I'll need to set the listview to select the first item, and then DO UNTIL it's at the last item.

Thanks everyone!

-Matthew-
www.comperfection.com

Moving On A Listview
How can i move to the next record on a listview automatic?
I mean read the whole listview from record one to n

Moving Through Items In A Listview
Am I being a complete , or what? I'm trying to move through the items in a listview, so that I can insert the entries one-by-one in to DB - ie each item in the listview represents a new record in a DB table.

Now, I would have expected (as with all things VB) this to be quite straight forward. Something along the lines:

ListView1.selecteditem.movenext

I know this a bit hopeful, but I can't believe there's no way to incrementally move through all the items.

I've been through MSDN and searched this entire forum for a similar thing but I cant find anything.

I must be missing something really obvious here!

Listview Item Moving
Hi there,

is it possible to move items in a Listview control(Up and down the list) and how, this one is baffling me

the pig...

Moving Things From One Listview To Another
Hey guys I have one listview called report on a form call antivirus. This listview has checkboxes.

I have another listview with no check boxes on a form call resuls.

What I would like to do is when an item or items is checked, whatever is in the first column of the report listview on the antivirus form goes in the results listview on the resuls form. The same as the second column, I would like that repeated as well.

But the twist is if the user checks a problem and then presses the delete button. I would like the 3rd column of the results listview on the resuls form to say "Deleted" for that checked item.

OR if the user checks a problem and presses ignore then it would just say Ignored by the item in the 3rd column.


Can anyone tell me how I could do all that?

Thanks!

Listview, Moving Columns?
Well, i cant really explain the title in just a few words. I want to add 2 more rows to my listview, but i dont want to add them at design time (alot of code to change then).

The problem is, that i want the two rows that i add, i want to move them so they are positioned in-between two columns that are already there.
So, i added rows 12,13 to my listview during design time. I want 12 and 13 to appear to be inbetween columns 1,2.

Hope it makes sense

Listview - Moving A Selected Row Up Or Down
Hi,

I want to allow the user to order items in a listview according to their choice. So I need to move a selected row in a listview up or down (by pressing up or down command button). How can this effect be acheived ?

TIA

mecracked

Moving Items In A ListView
Hi,
I'm using a ListView to show information. I want the user to be able to click and drag one of the ListView items to move it higher or lower on the ListView. Is there any way to do this? I know that you can do it with command buttons, but is there a way to do it with the mouse?

Thanks!

Disable Moving Of Image In Listview???
I use ListView in Microsoft Windows Common Controls 6.0 (SP6). I can add image to fill background but when i scroll-down, the image is moved!

I want image not to move. How i have to do?

pls help!

Thanks

Moving Things From A Listview To A Textbox?
Hey guys I have a listview called report and it has check boxes. I have another form called form2 with a text2.text.

Is there a way when I check one item and press a button that checked item goes in the text2 of the form2?

Its just the item from the first column of the report listivew.

Thanks!

Moving Multiple Listview Items Up Or Down At Once
Hi, does anybody know how to move multiple selected listview items up or down at once?

I found the subs below, but they only move one item up or down, even if I have selected multiple items.

Thanks.


vb Code:
Private Enum menmDirections    MoveUp = 1    MoveDown = 2End Enum Private Sub MoveItem(ByVal penmDirection As menmDirections)Dim lvwItem     As ListItemDim lvwNew      As ListItemDim lvwSubItem  As ListSubItemDim lngIndex    As Long    Set lvwItem = lstView.SelectedItem    If Not (lvwItem Is Nothing) Then        If penmDirection = MoveUp Then            lngIndex = lvwItem.Index + 2        ElseIf penmDirection = MoveDown Then            lngIndex = lvwItem.Index - 1        End If        If lngIndex > 0 And lngIndex <= lstView.ListItems.Count + 1 Then            Set lvwNew = lstView.ListItems.Add(lngIndex, , lvwItem.Text)            For Each lvwSubItem In lvwItem.ListSubItems                lvwNew.ListSubItems.Add , lvwSubItem.Key, lvwSubItem.Text, lvwSubItem.ReportIcon, lvwSubItem.ToolTipText            Next lvwSubItem            lvwNew.Selected = True            Set lvwNew = Nothing            lstView.ListItems.Remove lvwItem.Index        End If        Set lvwItem = Nothing    End IfEnd Sub



vb Code:
Private Sub MoveUp(lv As ListView)    Dim itm As ListItem, itmNew As ListItem, i As Long    If lv.SelectedItem.Index > 1 Then        Set itm = lv.SelectedItem        Set itmNew = lv.ListItems.Add(itm.Index - 1, , itm.Text, itm.Icon, itm.SmallIcon)        For i = 1 To itm.ListSubItems.Count            With itm.ListSubItems(i)                Call itmNew.ListSubItems.Add(, .Key, .Text, .ReportIcon, .ToolTipText)            End With        Next        lv.ListItems.Remove itm.Index        itmNew.Selected = True        lv.SetFocus    End IfEnd Sub Private Sub MoveDown(lv As ListView)    Dim itm As ListItem, itmNew As ListItem, i As Long    If lv.SelectedItem.Index < lv.ListItems.Count Then        Set itm = lv.SelectedItem        Set itmNew = lv.ListItems.Add(itm.Index + 2, , itm.Text, itm.Icon, itm.SmallIcon)        For i = 1 To itm.ListSubItems.Count            With itm.ListSubItems(i)                Call itmNew.ListSubItems.Add(, .Key, .Text, .ReportIcon, .ToolTipText)            End With        Next        lv.ListItems.Remove itm.Index        itmNew.Selected = True        lv.SetFocus    End IfEnd Sub

LISTVIEW(stoping Icons From Moving..)
i have been seaching for a way to disable moving of icons in a listview.. and i haven't found anything yet. I see it possible in other programs.. but how is it done??? that i don't know. So i am asking you all if there is a way.. a non API approach would be much better.

Listview Report Moving Items Up && Down
Hi everyone ,

I know how to move the first column field up and down in a listview report.

But now i have 10 columns and the user wants to select a row and puts it one down (if its not already at the bottom) or one up (if its not already at the top).

thx

ListView - Stop Icons Moving
Hi,
I'm using a listview control in the Icon mode, to display a control panel for my application. The only problem is that when a user clicks an icon, when you move the mouse it moves the icon as well.

Is there any way to stop the user moving the icon?

Moving The Selected Item In Listview
****
I solved the problem, thanks to all for your attempt at helping.

Here is the code:

Set ListView.SelectedItem = ListView.ListItems(i)
****

I have a Listview populating from a database and sorts the data alphabetically.

Now when the user deletes an item from the database, it also refreshes the listview.

The question I have is, the listview always sets focus to the last item it added, however it does not add them alphabetically, so after there added and the listveiw sorts them, the item selected could be anywhere!? How can I have this list view set focus to the first entry? Or better yet one that I specify or has been saved (IE save the record ID when they exit the prog, so when they come back I can pull that and set focus to that item)??

Thanks for the help.
Bryan

[This message has been edited by Bryan (edited 01-12-2000).]

Moving ListView Column Headers
Is there a way that the user can move the Column headers of a list view control. Additionally a way to select the whole line rather than the first column.

Thanks.

Moving Columns On A Listview (Report View)
I want to programmatically set the Position of the columns in a list view.

This is an "after thought" so I am trying to do it on already loaded listviews.


I see from a little experimentation that I can easily move the column headers by simply changing the .position property.

But that does not bring over the data for that column. (Just the header)

Do I have to manually move the data or there an easier way?


(By "manually move the data" I mean set up a temp array, copy the column's data, update new column after moving other column into original col number)


Regards,

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!

Code For Moving To The First Blank Cell In A Worksheet; Moving Left,right,up Or Down
I have created an application form as a userform in Excel. I need to send the data entered into my text boxes when the program runs to separate excel cells in a worksheet.

My problem is I can use code that will send the textbox entry to a specific cell eg. If my textbox is named Surname I can say

range("a5").value = surname but if I do that when I run the programme to enter the next record for someone else the first record will be overwritten.

I NEED A CODE LINE THAT WILL TAKE ME TO THE FIRST EMPTY CELL AND ALLOW ME TO MOVE DOWN OR TO THE LEFT OR TO THE RIGHT

Moving Balls To Moving Images??
Please take a look at this as it is related to my question
Thread

is it possible for the create images to be an image type that is already drawn?

[Read] Need Help With Custom Scrollbars On A Listview Control! Or Skinning Listview..
I have been searching for weeks now to find a way to use a custom scrollbar to scroll a listview...

Like this:



Now I use an alternating BG function on my listview and I am currently using the ensurevisible method of scrolling a listview...

Is there a better way?

I will post some example projects if needed...

But how would I use a custom scrollbar on a listview control

Thanks for helping

How To Unselect Listview Row When I Click On White Area Of Listview Under Rows?
Hi all. could any one show me how i can detect if user clicked(left and write) on white area of listview as shown in the pic. When i say white area i mean area where there is no row in listview . I want to detect click on that white area and be able to unselect row and make frame invisable.

2 ListView Questions. 1 About Selecting Records. 2 About Adjusting Listview Box Size.
Hi,
I'm changing some of my programs to use a ListView instead of a ListBox.

1. On selecting a record how do I pass the info from the fifth column to another Sub? (I have .FullRowSelect = True)

2. I'm dynamically adjusting the column widths to the maximum length of the data going into the column. Is there a way to dynamically adjust the width of the listview box itself to be the sum of the column widths?

Thanks,
Al.

How To Unselect Listview Row When I Click On White Area Of Listview Under Rows?
Hi all. could any one show me how i can detect if user clicked(left and write) on white area of listview as shown in the pic. When i say white area i mean area where there is no row in listview . I want to detect click on that white area and be able to unselect row.

How To Compare 2 Listviews And Copy Listview Content To Another Listview?
Hi all. I am filling a listview with xml data as shown in code beleow. I am calling this part using timer.What i want at the end of this code to compare listview1 with listview2. If they are diffrent or if listview2 is empty then i copy content of listview1 to listview 2.Otherwise do nothing. could any one show me how i can make such compare an copy?Thanks


1 Code:
Dim objDoc As MSXML2.DOMDocument
Dim objNodelist As IXMLDOMNodeList
Dim objNode As IXMLDOMNode
Dim lvwItem As ListItem


    'load the xml document
    Set objDoc = New MSXML2.DOMDocument
    objDoc.async = False
    objDoc.Load "http://localhost/data.php"
   
    'add all the song nodes into a  nodelist
    Set objNodelist = objDoc.selectNodes("//song")
   
    'Clear the listview
    ListView1.ListItems.Clear

    'Loop through each song node and add to the list view
    For Each objNode In objNodelist
        Set lvwItem = ListView1.ListItems.Add(, , objNode.selectSingleNode("artist").Text)
        lvwItem.SubItems(1) = objNode.selectSingleNode("name").Text
        lvwItem.SubItems(2) = objNode.selectSingleNode("image").Text
        lvwItem.SubItems(3) = objNode.selectSingleNode("rating").Text
        lvwItem.SubItems(4) = objNode.selectSingleNode("songid").Text
        lvwItem.SubItems(5) = objNode.selectSingleNode("totalvotes").Text

    Next objNode

''Here i want to compare listview1 with listview2. If it is empty or diffrent if fill it
otherwise i do nothing.

Set lvwItem = Nothing
    Set objNodelist = Nothing
    Set objDoc = Nothing

***RESOLVED***ListView / How To Select A Row From 2 Seperate ListView Controls
I have 2 ListView controls on a form. I want the user to be able to highlight a row in both ListViews. The problem is when the user selects (highlights) a row from ListView1, as soon as ListView2 is clicked the row selection (highlight) made in ListView1 disappears.

Thx

Looping Through A Listview And Adding Contents From One Listview To Another
i have my code for my old listbox but i need to convert it to the listview

any help?


Code:
For i = 0 To frmmain.lstQY_IT_DES.ListCount
lstprint.AddItem frmmain.lstQY_IT_DES.List(i)
Next i

Listview.Add No Longer Recognize? Listview.mscomctllib Instead?
So I hadn't done some Vbasic coding in like a month. Then i go to edit my code and find the debugger throwing an error on my listview.add.

I delete the .add and hit the . key to see what the supported methods are and it only shows "MSComctlLib" as my option. But then it throws an error when i try to select that. How did this happen and more importantly how do I get back to normal listview methods?

Listview; Getting Data (populate Listview) From 2 Tables??
hi!

im using a listview of my program..
where i need popluate the it with data coming from 2 tables, (table 1 and table 2); and where one of the entities in both table are the same...
for instance;
table 1 = stud_genInfo
table 2 = stuf_Offenses
both has the entity= stud_Number..
in which i need to show the stud number in my listview..

how can set (code) to show the Stud_no.?? confused:

can anyone help me with this one?? pls i need ur help, badly...

i would appreciate all the help/suggestions anyone would give..

mauve
-----
btw, this is a snip of my code:

strToday = Format (now, "mmddyyy")
With rsSearch
.Open "SELECT * FROM GenIndo, Offenses WHERE Schedule.Date_Today = '" & strToday & " ' And Schedule.Stud_No =CheckUp.Stud_No", CN, adOpenStatic, adLockPessimistic

If .RecordCount <= 0 Then
lvwSchedule.ListItems.Clear
Else

lvwSchedule.ListItems.Clear
.MoveFirst


Do Until .EOF


Set xlist_item = lvwSchedule.ListItems.Add(, , !Stud_NO) ' this is the line(part) where VB highlights the error

xlist_item.ListSubItems.Add , , (UCase(!Last_Name) & ", " & !First_Name & " " & !Middle_Name)
xlist_item.ListSubItems.Add , , (!Offense)
xlist_item.ListSubItems.Add , , (!Offense_Type)
xlist_item.ListSubItems.Add , , (!Offense_No)
.MoveNext

Loop
End If
.Close
End With

Set rsSearch = Nothing


-------

thank u so much...:

Combine 2 Listview Items Into One Listview
I have 2 listviews that have a different listitems.

ex.

LV 1 LV 2
1. A 1. B
2. C 2. D
3. E 3. F


Is there a way to combine the 2 to another listview so that they all look like this with out doubles of matching items?

ex.

LV 3

1. A
2. C
3. E
4. D
5. E
6. F

Listview Problem; Listview.selecteditem
So, I have a listview that displays a series of things, and refreshes every 10 seconds. (By refresh, I mean it clears itself and re-fills all info from a database)

When it refreshes, I want to check and see if any message was selected before the refresh, and if so, select it again.


Code:
'select nothing...GRRRRrr
For i = 1 To frmQuickCom.lstMessages.ListItems.Count
frmQuickCom.lstMessages.ListItems(i).Selected = False
Next

'Reselect the originally selected item
'if there are
Select Case SelText 'this is passed in when this sub is called'
Case ""
'if there are no messages, don't select any
If frmQuickCom.lstMessages.ListItems.Count > 0 Then
frmQuickCom.lstMessages.SelectedItem.Selected = False
End If
Case Else 'something was selected
For i = 1 To frmQuickCom.lstMessages.ListItems.Count
If SelText = frmQuickCom.lstMessages.ListItems(i).Text Then
Set frmQuickCom.lstMessages.SelectedItem = _
frmQuickCom.lstMessages.ListItems(i)
frmQuickCom.rtfMessage.Text = strMsgTransfer
frmQuickCom.lstMessages.SelectedItem.EnsureVisible
End If
Next
'move the window to show the selected item
End Select

So here's the problem -- even if I set selecteditem.selected = false, Selecteditem still has a value. Is there anyway to actually clear that value entirely? (The reason why I ask -- if a message is deleted, it is leaving the last added item (in the next refresh) as the 'selected' item, even though it gets set to false. If I try to key off of the selecteditem value, then, it returns something.)

Drag Listview, Target Is The Same Listview
Hello,

I would like to let the user set a priority on listviewitems by multiple selecting them and dragging them to the correct priority.

So.. I would like to drag and drop a multiple selection and the target is the same listview.


I hope this makes sence.


patrick.

How To Copy Listitems In Listview To Another Listview?
I have "LISTVIEW 1" with 8 columnheader, I just want to show only 2 columnheader together with its items in "LISTVIEW 2" . How I can do that? Have sample as starting point

Combine 2 Listview Items Into One Listview
I have 2 listviews that have a different listitems.

ex.
________________
LV 1 l LV 2 l
l l
1. A l 1. B l
2. C l 2. D l
3. E l 3. F l
_______l_________l

Is there a way to combine the 2 to another listview so that they all look like this with out doubles of matching items?

ex.
_______
LV 1 l
1. A l
2. C l
3. E l
4. D l
5. E l
6. F l
_______l

Drag And Drop From Listview To Another Listview
Hey Guys,

I've think i've tried everything but cant get it to work. I can get it to work to a text box or a list bow but not to another Listview!!

Anyone know how to drag the contents of a listview to another listview??

b

Listview Finditem, Result At Top Of Listview
Hello,

I use the function FindItem in order to find what I want. I have one problem : I would like that the result is at the top of the listview, it means, the first visible, not the first of the complete list.

Thanks you

ListView -Drag&&Drop- ListView
Does anybody have an example about how to do a Drag & Drop of items between two ListViews? Any help would be welcome. Thanks, in advance.

How To Filter One ListView To Another ListView&lt;Resolved&gt; I Think
I have a listView that displays the content of an Access Database. So far so good. Now I want to the line items in another ListView based on the content of one field. That's where I get lost. I can check the value of desired field IF that line is highlighted, but How do I cycle thru all the Items to send to my second listview?

Any suggestions?

Sample list:
Author Title Describe In(this is a checkbox) Out(this is a checkbox)
kf4iis How to Fix It How to Fix Things (Unchecked) (Checked)

crude example I know.

Any suggestions would be helpful

Charles



Edited by - kf4iis on 6/2/2004 6:27:40 PM

Moving
i want to be able to have a pre drawn square in a corner of a form and allow the user to click and drag it to a new location. it sounds simple enough but i am struggling with it. does somebody have a tutorial on this stuff

Moving MDI Bar
I have created a Usercontrol as a menu, when the child forms are maximised the relevant control box for that form is above the Usercontrol, is there anyway to position it below the Usercontrol?

Edit: Ooops! Its an MDI form (maximised) with several children.

Cheers

Moving 360
how do you move a player through 360 so it walks the at 1 or 34 or whatever degrees ?

i attempted throught trig but it had its problems

Code:
Dim dir As Double
Const pi = 3.14159265358979

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Select Case KeyCode
Case vbKeyLeft
dir = dir - 10
Case vbKeyRight
dir = dir + 10
Case vbKeyUp
If dir = 90 Then
you.Top = you.Top + 10
Exit Sub
End If
If dir = 180 Then
you.Left = you.Left - 10
Exit Sub
End If
If dir = 270 Then
you.Top = you.Top - 10
Exit Sub
End If
If dir = 360 Then
you.Left = you.Left + 10
Exit Sub
End If

If dir < 90 Then
you.Left = you.Left + 10
you.Top = you.Top + 10 * Tan(dir * pi / 180)
End If
If dir > 90 And dir < 180 Then
you.Left = you.Left - 10
you.Top = you.Top - 10 * Tan(dir * pi / 180)
End If
If dir > 180 And dir < 270 Then
you.Left = you.Left - 10
you.Top = you.Top - 10 * Tan(dir * pi / 180)
End If
If dir > 270 And dir < 360 Then
you.Left = you.Left + 10
you.Top = you.Top + 10 * Tan(dir * pi / 180)
End If

End Select
If dir > 360 Then dir = 0
If dir < 0 Then dir = 360

End Sub

Moving
Ok Iam finding this really difficult to do. Iam able to move a shape upwards using this code.


Shape1.Top = Shape1.Top + Vy
When it reaches a specific point I want it to move in the opposite direction so I included this code.

If Shape1.Top = 160 Then

Shape1.Top = Shape1.Top - Vy
End If
I have put this in the timer but when top = 160 the shape stops moving. Why is this/?? Am I doing something wrong here??

Moving And Looking In D3d
Well, i have done a little 3d world and i want to be able to move in different directories and looking up & down at the same time. I made something, but if i look up(or down) and then turn left(or right) then it rotates the view so, that the camera turns on it's back (**** it's hard to say what you want, if you're not English)

Moving Down One Row
Hi all,

I've tried searching for what, I thought would be simple enough to do, a way to move down one row in my worksheet and select it.

I'm trying to read a table from a database and populate the data into a worksheet.

I've learned how to move to the left (ActiveCell.Next.Select), but after I have written the record, I want to be able to move down to the next row and to the first column.

Here's my code:


Code:
'Starting on row 2 because I have a header.
Range("A2").Select

Do Until rec.AbsolutePosition = adPosEOF

For i = 1 To rec.Fields.Count Step 1 'Loop as many times as there are fields
If ActiveCell.Column = 1 Then
ActiveCell.Value = rec.Fields(i - 1).Value
ActiveCell.Next.Select
Else
ActiveCell.Next.Select
ActiveCell.Value = rec.Fields(i - 1).Value
End If
Next i

rec.MoveNext
'Move down to next row and over to column 1
'I'd like to put "Range(CurrentRow +1 & Column 1).Select" here

Loop

Can't I do this without a row counter?
Any suggestions?
Thanks in advance.

Jason

Moving To Web With VB
If I was interested in integrating some vb into a web page, is it possible and how. Any sites you could recommend would be appreciated. I basically just need to know where to look for some direction in putting forms that function like vb listboxes on a webpage...ones that populate automatically...etc..

Or forms, when they are filled in to capture that data like textboxes..etc for use in building data files ...

Thanks in advance

Moving My Box
I have a shape (box) on my form that I want to have move across the the screen when I click on a command button. I've tried using the following on the command button but it will only work the one time:


Code:

AccVar = true

If AccVar then

Shape1.Left = Shape1.Left + 10

end if
I assume this is because VB only cycles through the code once (on each button click). I tried putting the IF statement in the Form Load but it didn't work because I assume code only triggers when the form loads. What is the best or any way of getting my box to move when the button is pressed?

Is there any tutorials on the web about moving objects in VB?

Moving
OK...

I wanna know how I can make a label move down whenever I press the down key...

can anyone help???

thanks...

Moving Exe From Within
is there a way i can move, or copy the EXE thats running into a new location?

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