Tuesday, February 22, 2011

Write a Visual Basic Program (VB) to convert name in abbreviation

WAP Procedure to convert name in abbreviation
___________________________________________
Private Sub Command1_Click()
Call convert
End Sub

Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""

End Sub

Private Sub Form_Load()
Text1.Text = ""
Text2.Text = ""
Text2.Enabled = False
Text2.FontSize = 22

End Sub
Public Sub convert()
Dim a, b, c, d, i, j, k, l, m
l = Len(Text1.Text)
If Text1.Text <> "" Then
a = Mid(Text1.Text, 1, 1)
b = InStr(1, Text1.Text, " ")
If b <> 0 Then
Text2.Text = "YeS"
c = Mid(Text1.Text, b + 1, 1)
i = InStr(b + 1, Text1.Text, " ")
If i <> 0 Then
j = Mid(Text1.Text, i + 1, 1)
d = UCase(a + "." + c + "." + j)
m = InStr(i + 1, Text1.Text, " ")
If m <> 0 Then
Text1.Text = "Only Three strings allowed"
d = "RE Enter"

End If

Else
j = Mid(Text1.Text, b + 1, 1)
d = UCase(a + "." + j)

End If


Else
k = Mid(Text1.Text, 1, 3)
d = UCase(k + ".")
End If


Else
d = "ENTER TEXT"
End If

Text2.Text = d
End Sub
____________________________________

OutPut
____________________________________



____________________________________
DOWNLOAD
____________________________________

Download its form

Download its Image



No comments:

Post a Comment