hi There please help me in these program because the character only moves 1 time but it must be like this

input: abcd
output: dabc
then when i click forward again
output cdab
output: bcda
output: abcd
like this and also it must be in backward to when i click the backward button.

Private Sub btnForward_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnForward.Click
        Dim str As String = txtInput.Text
        Dim x As Integer
        Dim str2 As String


        For x = 0 To str.Length - 1
            lblOutput.Text = str.Substring(x, 1) & str.Substring(0, 3)
        Next

    End Sub

Recommended Answers

All 9 Replies

Say exactly what you want

look i know that my english is bad and i don't know how to explain it more clearly than that ok.
the output should be like this(and when i click forward the character 'd' moves forward)
Input: abcd
output: dabc
output: cdab
output: bcda
output: abcd
this is continuous

You mean permutation. You may want to read up here

Dim str As String = "abcd"
        Dim a As String = Microsoft.VisualBasic.Right(str, 3) '' its mean a = "bcd"
        a &= Microsoft.VisualBasic.Left(str, 1) '' its mean "bcd" & "a"
        MsgBox(a)

i hope it ll help :)
if u have question u can ask

How about

Private Function Rotate(ByVal s As String, ByVal places As Integer)

        places = places Mod s.Length
        If places < 0 Then places += s.Length
        Return Mid(s, places + 1) & Mid(s, 1, places)

    End Function

Try a few values (positive and negative) for "places". Note the "mod" function handles the case where the number of places is greater than the length of the string. Also, you can give positive or negative values for places to rotate in either direction.

Thanks

Hi there, I would like some help with a project manipulating strings in VB. I want to explain what is all about.
In the program we must enter a word(s) lets say for example " never say never", and also we have to enter a key word, for instance: "Exam". Then, the word(s) has to be encrypted involving two strings * for the word(s) an keyword strings* , So each letter in the word(s) string has to be encrypted by the value of the corresponding letter in the keyword.

For example:

input word(s): " never say never"
input keyword: "exam"
ouput: here has to ouput just letters
ouput: here again the word " never say never" has to be display

Please do not hijack threads. Your question should be posted as a new thread.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.