Dim wordcount As Integer = Regex.Matches(TextBox1.Text, words).Count
the whole code
Imports System.Text.RegularExpressions
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles start.Click
clear.Enabled = False
lumabas.Enabled = False
cancel.Enabled = True
'Get the input sentence
' Dim INPUT As String
' Input = InputBox("Enter Your String ")
If TextBox1.Text = String.Empty Then
MsgBox("Please Enter A String", vbInformation + vbOKOnly, "String Input")
Else
'Split the sentence into word
Dim splitstring() As String = TextBox1.Text.Split(CChar(" "))
'OR DIM SPLITSTRING () AS STRING = TEXTBOX1.TEXT.SPLOT("")
'make listbox 2 display words sorted in alphabetical order
For Each words As String In splitstring
'Count how many times the word is in the sentence
Dim wordcount As Integer = Regex.Matches(TextBox1.Text, words).Count
'PAG TINANGAL ANG COUNT CANNOT BE CONVERTED INTO INTEGER
'string input letter
ListBox3.Items.Add(words)
'string will become number
ListBox1.Items.Add(words.Length)
'count the repeated word
ListBox2.Items.Add(wordcount.ToString)
Next
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles clear.Click
ListBox1.Items.Clear()
ListBox2.Items.Clear()
ListBox3.Items.Clear()
TextBox1.Text = String.Empty
End Sub

New Topic/Question
Reply



MultiQuote






|