Saturday, July 29, 2017

Count Number of Eight Digits in Visual Basic NET

A simple program that will ask the user to give a series of numbers in integer format. Our program will count the number of eight digit occurrence based on the given number by our user. The code is written in Visual Basic NET and it is very easy to understand.

My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

Thank you.







Sample Program Output


Program Listing

Public Class Form1

    Public Function CountCharacter(ByVal value As String, ByVal ch As Char) As Integer
        Return (New System.Text.RegularExpressions.Regex(ch)).Matches(value).Count
    End Function


    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Label2.Text = "Total Number of  Number of 8 Digitst is " & CountCharacter(TextBox1.Text, "8") & "."
    End Sub

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        End
    End Sub

    Private Sub Label2_Click(sender As Object, e As EventArgs) Handles Label2.Click

    End Sub

    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        TextBox1.Text = ""
        Label2.Text = ""
        TextBox1.Focus()
    End Sub
End Class


No comments:

Post a Comment