开发者

VB.NET take each letter of a word and display in ListBox

 Private Sub btnWord_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnWord.Click
    Dim Inputter As String
    Dim Words As String = ""

    Do
        Inputter = InputBox("Enter word", "Enter Word")
        If Inputter <> String.Empty Then
            lstDisplay.Items.Add(Inputter)
            Word += Inputter.Substring(0, 1)
        End If
    Loop Until Inputter <> String.Empty
    ' SOMETHING GOES HERE!!!!!'
    lstDisplay.Items.Add("---")
    lstDisplay.Items.Add(Word)
End Sub

Here is how it works, when you click the bu开发者_如何学Pythontton it displays an input box so for example type in "CAT".

But I can't figure out how to get it to do C (newline) A (newline) T (newline) within the listbox. Please help!

C

A

T

-

CAT


Private Sub btnWord_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnWord.Click 
    Dim Inputter As String Dim Words As String = ""

    Inputter = InputBox("Enter word", "Enter Word")
    Dim i as Integer
    For i = 0 To Inputter.Length-1
        lstDisplay.Items.Add( Inputter.Chars(i).ToString )
    Next

    lstDisplay.Items.Add("---")
    lstDisplay.Items.Add(Word)
End Sub
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜