Listview problem - Setting the current line to display 
Author Message
 Listview problem - Setting the current line to display

I am having trouble making sure that the line in the listview I want to make
see is visible. I have been using .EnsureVisible to try and get the line I
want to be displayed.  However if there is more than one screen of data and
I want the last item to be displayed i.e. lastedit=total_prcess, the last
item appears just below the bottom of the visible part of the listview.

Is there a way of forcing the complete line to be visible?

I have put the code for comments below.

--
Best regards

 Andy Stewartson
 Mechanical Engineer Team Leader
 Mechanical Engineering Design Services
 Avionics Group
 BAE SYSTEMS Avionics Ltd
 Rochester, ME1 2XX
 Tel: +44 1634 204562
 Fax: +44 1634 816360

    Dim si                 As ListSubItem
    Dim li                  As ListItem
'
' update display
'
    For i = 1 To total_process
'
' set colour
'
        fore_colour = BLACK
'
' if process less than 6sigma then make red and count
'
        If scorecard(i).hitter > 0 Then fore_colour = RED
'
' if excluded then show as green
'
        If scorecard(i).exclude > 0 Then fore_colour = GREEN
'
' last change item show in blue
'
        If i = lastedit Then fore_colour = BLUE
'
' add item number
'
        Set li = Form1.ListView1.ListItems.Add(Text:=Format(i,
items_format))
        li.ForeColor = fore_colour
'
' add operation
'
        Set si = li.ListSubItems.Add(Text:=default_operations(process_id,
operation_id))
        si.ForeColor = fore_colour
'
' add grade
'
        msg = default_grades(grade_id)
        Set si = li.ListSubItems.Add(Text:=msg)
        si.ForeColor = fore_colour
'
' add number off
'
        Set si = li.ListSubItems.Add(Text:=scorecard(i).ofd)
        si.ForeColor = fore_colour
'
' make sure last change is visible,  if delete has been user then lastedit
will be negative
'
        If i = Abs(lastedit) Then li.EnsureVisible
'
        Next



Sun, 07 Aug 2005 00:05:57 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. VB ListView Control - How to just display column lines - no row lines

2. Display Current Line # in RTB

3. Display Current Line # in RTB

4. How to programmicly cause Listview to display its text from another line not in view

5. LISTVIEW - multi line Display

6. Displaying the Current Date and Current Time

7. Listview: check if an item in current listview

8. Problem using GetPrivateProfile to set current path

9. ListView problems - improper sort and lines when scrolling

10. VB4a/32: Problem displaying hourglass on ListView Column Sort

11. WCChart - How to create Horiz Line, problem with Displaying Markers

12. MS Office Components(WCChart) - How to create Horiz Line, problem with Displaying Markers

 

 
Powered by phpBB® Forum Software