Logo 
Search:

MS Office Forum

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds

ListBox last item not visible

  Asked By: Jaxson    Date: Oct 07    Category: MS Office    Views: 1527
  

I'd be interested to know if anyone else has experience of this
problem, and if there is any workaround:

Insert a UserForm
Draw a listbox called ListBox1
Paste the following code:

Private Sub UserForm_Initialize()
ListBox1.Top = 0
ListBox1.AddItem "ListLine"
ListBox1.AddItem "ListLine"
ListBox1.AddItem "ListLine"
ListBox1.AddItem "ListLine"
ListBox1.AddItem "ListLine"
ListBox1.AddItem "LAST LINE"
End Sub

Private Sub UserForm_MouseMove(ByVal Button As Integer, ByVal Shift
As Integer, ByVal X As Single, ByVal Y As Single)
If Button <> 1 Then Exit Sub
ListBox1.Height = Y
End Sub

Now run the form and resize the listbox by clicking on the form
background until the last item is not visible, and the scroll bar
appears.

Scrolling down does not scroll to the last line!


The following code resolves the scrolling, but changes the height of
the listbox which is no good:
Private Sub UserForm_MouseUp(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
ListBox1.IntegralHeight = False
ListBox1.IntegralHeight = True
End Sub

I realise that I'm being a bit obstinate to insist on a completely
variable listbox height, but it is appropriate in this instance!

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Sage Anderson     Answered On: Oct 07

Works fine in 2003 on XP Pro..................

 
Didn't find what you were looking for? Find more on ListBox last item not visible Or get search suggestion and latest updates.




Tagged: