Write a VB application to count the number of Blanks,Tabs,and Newline characters in a given string.Use appropriate controls and provide a user friendly interface.
Click to see a simple program of this type The number of digits in the entered Number...
Refer Total words,Characters,sentence,length of ... also
Click to see a simple program of this type The number of digits in the entered Number...
Refer Total words,Characters,sentence,length of ... also
A) Program Design :
(B) Property(Controls Used) :
- Four Labels and change their CAPTIONS as : Enter a Paragraph,White Spaces,Horizontal Tabs and New Lines.
- One Command Button and change its CAPTION as Count Spaces.
- Four Text Boxes and delete their Text Properties.
Private Sub Command1_Click() i = 1 linecnt = 1 tabcnt = 1 spacecnt = 1 Dim str As String str = Text1.Text For i = 1 To Len(str) If Mid(str, i, 1) = vbLf Then linecnt = linecnt + 1 ElseIf Mid(str, i, 1) = " " Then spacecnt = spacecnt + 1 ElseIf Mid(str, i, 1) = vbTab Then tabcnt = tabcnt + 1 End If Next Text2.Text = spacecnt Text3.Text = tabcnt Text4.Text = linecnt End Sub |
No comments:
Post a Comment