Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27360

VS 2010 [RESOLVED] Help in converting into different alternate CaSe after reversing the text

$
0
0
Hi guys! I'm a beginner here in vb.net world

My main task is to reverse the input text from a textbox to another textbox and change the casing of the output into alternate upper and lower case:

Example:

Input: visual
Output: LaUsIv

I already searched for the proper code to use but it seems that my syntax is not appropriate. . .
What do I need to do guys? Please help me.Thanks!
I also attached a screenshot of the design. It's already working in a reverse form. It's just not working when it comes to alternate upper and lower case.
Attachment 97859

Code:

Public Class frmReverse

    Private Sub btnReverse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReverse.Click
        txtOutput.Clear()

        Dim intLen As Integer
        Dim KeyAscii As Integer
        Dim j As Integer = Len(txtInput.Text)

        For i As Integer = 0 To Len(txtInput.Text) - 1
            txtOutput.Text += Mid(txtInput.Text, j - i, 1)
            intLen = Len(txtInput.Text)
                    If intLen Mod 2 = 0 Then
                        ' Upper case
                        KeyAscii = Asc(UCase(Chr(KeyAscii)))
                    Else
                        ' Lower case
                        KeyAscii = Asc(LCase(Chr(KeyAscii)))
                    End If
        Next

    End Sub

    Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
        txtInput.Focus()
        txtInput.Clear()
        txtOutput.Clear()
    End Sub
End Class

Attached Images
 

Viewing all articles
Browse latest Browse all 27360

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>