Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Clipboard.GetDataObject.GetDataPresent(DataFormats.Text) Then
Me.RichTextBox1.Paste()
RichTextBox1.Text = RichTextBox1.Text & vbCrLf
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim counter As Integer = 0
Dim bigString As String = RichTextBox1.Text
Dim textChar As Char
Dim test As Char
Dim wordCounter = 0
For counter = 0 To bigString.Length - 1
textChar = bigString.Chars(counter)
If textChar = " " Then
wordCounter += 1
End If
Next
MessageBox.Show("There are " & wordCounter & " words.")
End Sub
No comments:
Post a Comment