|
-
Jun 26th, 2004, 09:45 PM
#1
Thread Starter
Junior Member
Any idea how to fix this?
OK - I've got a listbox that displays "True", "False", or "Missing Item" to numberpad keys 1, 2, and 3. I'm trying to make a scoring utility. I want to have 20 items. I've got three problems with the following code, and I don't know how to fix them. Can anyone help?
Problem 1: The variables Items(X) don't seem to contain the values I'm trying to assign to them.
Problem 2: I can enter more than 20 items.
Problem 3: I'd like to edit the items by scolling up with the cursor keys and/or clicking on it, then entering the correct answer.
Here's the code:
Public Item(19) as char 'Each variable to hold a T, F, or space
Dim x as integer 'This will act as a counter
Private Sub lstViewScore_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles lstViewScore.KeyDown
For X = 1 To 20
If e.KeyValue = Keys.NumPad1 Then
lstViewScore.Items.Add("[T]")
Item(X) = "T"
ElseIf e.KeyValue = Keys.NumPad2 Then
lstViewScore.Items.Add(" [F]")
Item(X) = "F"
ElseIf e.KeyValue = Keys.NumPad3 Then
lstViewScore.Items.Add("Missing Item")
Item(X) = " "
End If
Next
lstViewScore.SelectedIndex = lstViewScore.Items.Count - 1
End Sub
This will probably be easy for someone, but it's driving me up a wall!
Ian
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
|