Hi! I'm trying to make my program count the number of words in my text box by counting the number of spaces, I tried this:
VB Code:
Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = 32 Then spacecount = spacecount + 1 End If Label1.Caption = "Word Count:" & spacecount End Sub
but whenever I type a non space character, it seems that spacecount is reset to 0. Oh yeah, I know the algorithm of my program for counting words is very problematic, I'll fix that later.




Reply With Quote