|
-
Mar 6th, 2004, 02:06 AM
#1
Thread Starter
Lively Member
scrolling a list box?
I am trying to scroll down a listbox, i.e., when they click list, it lists all of the items in a list. I can list and add to the listbox just fine, but when it reaches the end, it doesnt automatically scroll down... i need it 2 scroll down!
-
Mar 6th, 2004, 02:14 AM
#2
This will scroll to the last item:
VB Code:
If ListBox1.Items.Count > 0 Then
ListBox1.SelectedIndex = ListBox1.Items.Count - 1
End If
-
Mar 6th, 2004, 07:02 PM
#3
Thread Starter
Lively Member
this causes an error. the exact coe i am using in this part is
VB Code:
Sub listwords()
Dim arrCommands() As String = {"look", "go", "get", "put", "inventory"}
Dim i As Single = 0
Me.lstText.Items.Add("")
Me.lstText.Items.Add("Commands Are:")
For i = 0 To 4
Me.lstText.Items.Add(arrCommands(i))
Next
If lstText.Items.Count > 0 Then
lstText.SelectedIndex = lstText.Items.Count - 1
End If
End Sub
the error states: "An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dll
Additional information: Cannot call this method when SelectionMode is SelectionMode.NONE"
-
Mar 6th, 2004, 09:24 PM
#4
Like it says you can have an item selected when the selectionmode propert is set to None. Change it to something that allows selections.
-
Mar 7th, 2004, 07:26 PM
#5
Thread Starter
Lively Member
wow... this is definately not the newb forum...
i dont know vb that well, so i am asking for the code lolol
-
Mar 8th, 2004, 01:24 AM
#6
You don't need any code for that. Just select the Listbox on the form at designtime. Go to Properties on the lower right and find the SelectionMode property. Then set it to anything but None.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|