Avatar of December2000
December2000
 asked on

Case Statements in VB.Net

Hi Experts!

I am missing something.... The results should be "returned" txtWords.... Need an extra pair of expert eyes.... What am I missing? I am a newbie to .net :(

Public Class Form1

    
    Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
        txtNumber.Clear()
        txtWords.Clear()
    End Sub

    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
        Dim Sure As System.Windows.Forms.DialogResult
        Sure = CType(MsgBox("Are You Sure?", MsgBoxStyle.YesNo), Windows.Forms.DialogResult)
        If Sure = MsgBoxResult.Yes Then
            Me.Close()
        Else
        End If
    End Sub

    Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
        Dim strWords As String
        Dim intNumber As Integer

        intNumber = CInt(txtNumber.Text)

        Select Case intNumber
            Case 1
                strWords = ("One" & ControlChars.CrLf)
            Case 2
                strWords = ("Two" & ControlChars.CrLf)
            Case 3
                strWords = ("Three" & ControlChars.CrLf)
            Case 4
                strWords = ("Four" & ControlChars.CrLf)
            Case 5
                strWords = ("Five" & ControlChars.CrLf)
            Case 6
                strWords = ("Six" & ControlChars.CrLf)
            Case 7
                strWords = ("Seven" & ControlChars.CrLf)
            Case 8
                strWords = ("Eight" & ControlChars.CrLf)
            Case 9
                strWords = ("Nine" & ControlChars.CrLf)
            Case 0
                strWords = ("Zero" & ControlChars.CrLf)
        End Select
    End Sub

    Private Sub txtNumber_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtNumber.TextChanged

    End Sub

    Private Sub txtWords_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtWords.TextChanged

    End Sub
End Class

Open in new window

.NET Programming

Avatar of undefined
Last Comment
December2000

8/22/2022 - Mon
Ron Malmstead

Are you getting an error?
Or are you asking how to display the result of "strWords" ?
SOLUTION
Ron Malmstead

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
December2000

ASKER
Thank you @ xuserx2000

Yes,  how to display the results in txtWords.... It a application that converts 0-9 into words however there is a loop that continues to display the numbers as words as long as you continue enter the numbers.
ASKER CERTIFIED SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
December2000

ASKER
Thank you!
This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.
rwheeler23