VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Textbox as memo field, textboxes, memo, capitalization and more to come...

by Agbon M. Aitanu (1 Submission)
Category: String Manipulation
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Wed 16th November 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Textbox as memo field, textboxes, memo, capitalization and more to come...

Rate Textbox as memo field, textboxes, memo, capitalization and more to come...



    ' ===================================================================
    ' Split or brake a line when a user presses the ENTER KEY
    ' inside a text box during text entering.
    ' Also Capitalize every other word after the spacebar key was pressed
    ' ===================================================================
       Dim position, _
            longstring, _
            whatchr, _
            Count, _
            Countinteger, _
            leftsideofthestring
            
       position = 1
       whatchr = " "
       longstring = Street_name.Text
       leftsideofthestring = Left(longstring, InStr(position, ((longstring)), whatchr))
       
       Do While InStr(position, ((longstring)), whatchr)
          Dim leftstring, midstring, rightstring
          
          position = InStr(position, longstring, whatchr) + 1
          Count = Count + 1
          
          If position <> 0 Then
             leftstring = Left(longstring, position - 1)
             midstring = UCase(Mid(longstring, position, 1))
             rightstring = Mid(longstring, position + 1, Len(longstring))
             
             longstring = leftstring & midstring & rightstring
          End If
       Loop
        
       ' ========================================
       ' Change the first character to upper case
       ' if it is not already in upper case...
       ' ========================================
       longstring = UCase(Left(longstring, 1)) & Mid(longstring, 2, Len(longstring))
       Street_name.Text = longstring
End Sub


Download this snippet    Add to My Saved Code

Textbox as memo field, textboxes, memo, capitalization and more to come... Comments

No comments have been posted about Textbox as memo field, textboxes, memo, capitalization and more to come.... Why not be the first to post a comment about Textbox as memo field, textboxes, memo, capitalization and more to come....

Post your comment

Subject:
Message:
0/1000 characters