0% found this document useful (0 votes)
14 views6 pages

VB.NET String Handling Functions Guide

The document describes a program to perform various string handling functions in VB.NET. It outlines steps to create a Windows application project in Visual Studio, get user input, and use functions like length, concatenation, uppercase, lowercase, substring, replace, and split to manipulate strings. Code examples demonstrate implementing each function by clicking buttons that pass strings between two text boxes and display results. The goal is to successfully create a program that allows testing all the string functions.

Uploaded by

Amutha Arun
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views6 pages

VB.NET String Handling Functions Guide

The document describes a program to perform various string handling functions in VB.NET. It outlines steps to create a Windows application project in Visual Studio, get user input, and use functions like length, concatenation, uppercase, lowercase, substring, replace, and split to manipulate strings. Code examples demonstrate implementing each function by clicking buttons that pass strings between two text boxes and display results. The goal is to successfully create a program that allows testing all the string functions.

Uploaded by

Amutha Arun
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

8.

STRING HANDLING FUNCTION

July 15, 2014

Aim:
~~~~
To write a program to perform the string handling function using [Link].
Procedure:
~~~~~~~~~
Step1: Start the program in the Microsoft Visual Studio 2010.
Step2: File->new->project Select the project type as visual basic and select
the visual studio installed template as windows application.
Step3: Choose a Name, Location and Solution name.
Step4: Get an input string.
Step5: Using build function to find a string length, concatenation, split, upper case, lower
case, substring, replace, contains, remove, clear, rtrim, ltrim.
Step6: End of the program.

12PA01

Page 23

8. STRING HANDLING FUNCTION

July 15, 2014

Coding:
~~~~~
Public Class Form1
Private Sub comparecmd_Click (ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
Dim str As String
str = InputBox("Enter the string:")
[Link] = StrComp([Link], str)
End Sub
Private Sub clearcmd_Click (ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
[Link] = ""
[Link] = ""
End Sub
Private Sub exitscmd_Click (ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
End
End Sub
Private Sub copycmd_Click(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
TextBox2 .Text =String .Copy (TextBox1 .Text)
End Sub
Private Sub ltrimcmd_Click(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
[Link] = LTrim ([Link])
End Sub
Private Sub lengthcmd_Click(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
[Link] = Len([Link])
End Sub
12PA01

Page 24

8. STRING HANDLING FUNCTION

July 15, 2014

Private Sub replacecmd_Click(ByVal sender As [Link], ByVal e As [Link])


Handles [Link]
Dim s, n As String
s = InputBox("Enter the string replaced:")
n = InputBox("Enter the string replace:")
[Link] = Replace([Link], s, n)
End Sub
Private Sub uppercmd_Click(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
[Link] = UCase([Link])
End Sub
Private Sub lowercmd_Click(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
[Link] = LCase([Link])
End Sub
Private Sub middlecmd_Click(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
Dim s, n As String
s = InputBox("Enter the middle start string:")
n = InputBox("Enter the middle end string:")
[Link] = Mid([Link], s, n)
End Sub
Private Sub rtrimcmd_Click(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
[Link] = RTrim([Link])
End Sub
Private Sub substringcmd_Click(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
Dim n As String
n = InputBox("Enter the position:")
[Link] = [Link](0, n)
End Sub
12PA01

Page 25

8. STRING HANDLING FUNCTION

July 15, 2014

Private Sub concatecmd_Click(ByVal sender As [Link], ByVal e As [Link])


Handles [Link]
Dim a As String
a = InputBox("Enter the concatenation string:")
[Link] = [Link]([Link], a)
End Sub
Private Sub removecmd_Click(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
[Link] = ""
[Link] = ""
End Sub
Private Sub containscmd_Click(ByVal sender As [Link], ByVal e As [Link])
Handles [Link]
Dim n As String
n = InputBox("Enter the string")
[Link] = [Link] (n)
End Sub
Private Sub splitcmd_Click(ByVal sender As [Link], ByVal e As [Link]) Handles
[Link]
Dim n, s () As String
Dim i As Integer
n = [Link]
s = n. Split ("")
For i = 0 To [Link] - 1
[Link](s(i))
Next
End Sub
End Class

12PA01

Page 26

8. STRING HANDLING FUNCTION

July 15, 2014

Output:
~~~~~~

12PA01

Page 27

8. STRING HANDLING FUNCTION

July 15, 2014

Result:
~~~~~
Thus the string handling function program was successfully performed.

12PA01

Page 28

You might also like