Link to home
Start Free TrialLog in
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

Avatar of Ron Malmstead
Ron Malmstead
Flag of United States of America image

Are you getting an error?
Or are you asking how to display the result of "strWords" ?
SOLUTION
Avatar of Ron Malmstead
Ron Malmstead
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of December2000
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
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thank you!