2010-05-12 5 views
0
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 

Voici comment cela fonctionne, lorsque vous cliquez sur le bouton, il affiche une zone de saisie, par exemple tapez "CAT".VB.NET prendre chaque lettre d'un mot et afficher dans ListBox

Mais je n'arrive pas à comprendre comment le faire C (newline) A (newline) T (newline) dans la liste. S'il vous plaît aider!

C
A
T
-
CAT

Répondre

1
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

qui l'a fait grâce! – Kaleet

Questions connexes