DeadlyAura
Supreme [H]ardness
- Joined
- Jun 6, 2005
- Messages
- 4,857
I need some help guys (and girls of course). We have to write a VB program for my computer programming class and we can't figure somthing out. Our teacher also doesn't teach, he sits there and observes while we teach ourselves everything so therefore, I am having some trouble.
The assignment:
Now, I tried writing up some code but it doesn't all work, or work the way intended. What i have is this:
Any suggesstions?
Also, sorry for the badly written code. I've been choping away at it, throwing stuff in, taking stuff out, just trying to get SOMETHING to happen.
The assignment:
Write a program that will allow the user to type in as many words as they want. Your program should then display how many of each letter in the alphabet was typed in. This means, how may a’s did the person type in, how many b’s did the person type in, how many c’s did the person type in, etc. The computer should count both lower case and upper case letters as the same. Display your answer in a list box. Your program must use at least one array.
Now, I tried writing up some code but it doesn't all work, or work the way intended. What i have is this:
Code:
Option Explicit
Private Sub Command1_Click()
Dim letter
Dim text
Dim nletter As Integer
Dim i As Integer
Dim length
Dim word
Dim a
Dim lowcase
length = Len(txtIn)
nletter = 0
For i = 1 To length
letter = Mid(txtIn, i, 1)
Select Case letter
Case "A" To "Z"
lowcase = LCase(letter)
End Select
Next i
For i = 1 To length
letter = Mid(txtIn, i, 1)
Select Case lowcase
Case "a" To "z"
nletter = nletter + 1
Case Else
nletter = nletter + 0
End Select
lstOut.AddItem (letter + " = " + nletter)
Next i
End Sub
Any suggesstions?
Also, sorry for the badly written code. I've been choping away at it, throwing stuff in, taking stuff out, just trying to get SOMETHING to happen.