Playing with Text Boxes in VB6.0

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Ali Rizwan
    Banned
    Contributor
    • Aug 2007
    • 931

    Playing with Text Boxes in VB6.0

    Hello Every Body

    I want to do if the first letter of textbox is M then textbox show it Muhammad and other data will remain constant.
    i.e
    if M Saleem is written in textbox then Muhammad Saleem wll written in textbox

    And one thing more

    If i edit some thing in textbox and then goto some other control and when i goto textbox the cursor will have to on the end of text in textbox
    its urgent. Thanks in Advance
  • QVeen72
    Recognized Expert Top Contributor
    • Oct 2006
    • 1445

    #2
    Hi.

    Write this code in Text1_Change Event:

    Code:
    If Left(Text1.Text,1) ="M" And Left(Text1.Text,2) <> "Mu" Then
      Text1.Text = "Muhammad " & Mid(Text1.Text,2)
    End If
    Write this code in GotFocus Event of textbox:

    Code:
    Text1.SelStart =Len(Text1.Text)
    Regards
    Veena

    Comment

    • Ali Rizwan
      Banned
      Contributor
      • Aug 2007
      • 931

      #3
      Originally posted by QVeen72
      Hi.

      Write this code in Text1_Change Event:

      Code:
      If Left(Text1.Text,1) ="M" And Left(Text1.Text,2) <> "Mu" Then
        Text1.Text = "Muhammad " & Mid(Text1.Text,2)
      End If
      Write this code in GotFocus Event of textbox:

      Code:
      Text1.SelStart =Len(Text1.Text)


      Regards
      Veena


      Thanks a lot Qveen 72 i m very thank full to you because i want to automate my textboxes with letters. it will help me alot i ll use it.
      Thanks once again

      Comment

      Working...