I can only find answers on this using vba or java.
I am taking a user input from a textbox and counting the number of uppercase characters given.
This is homework so if you could even point me in the right direction I would be much obliged.
Private Sub BtnGo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnGo.Click
Dim Phrase As String
Dim CharPhrase As Char 'Convert Phrase to char for sting comparison
Dim Counter As Integer = 0 'used to measure the characters in textbox
Dim Caps As Integer = 0 'How many capitals are there?
Phrase = TxtboxPhrase.Text
If Phrase.Length <= 15 Then
MsgBox("There must be at least 15 characters in textbox")
Exit Sub
End If
While Counter <= Phrase.Length
'Code for counting here
End While
MsgBox("There are " & Caps & " capital letters in the current phrase")
Call ProgQuit()
End Sub
I’m a C# developer but here is the algorithm I would use in VB.NET:
EDIT: I ran this code through a C# to VB converter so there may be some issues. I just fixed one obvious one.