Automatic Capital Letter for 1st Letter??? 
Author Message
 Automatic Capital Letter for 1st Letter???

Private Sub Text1_Change()
    On Error Resume Next
    If Text1.Text <> "" Then
        Text1.Text = UCase(Left(Text1.Text, 1)) & Right(Text1,
Len(Text1.Text) - 1)
        Text1.SelStart = Len(Text1.Text)
    End If
End Sub

--
Clint LaFever

http://www.*-*-*.com/
http://www.*-*-*.com/ (personal)
(Home of the Code Depot Add-In)


Quote:
> Hi i was wondering how i would make the first letter that i input into a
> text box turn automatically into a Capital Letter???

> Thanks in advance



Sun, 01 Sep 2002 03:00:00 GMT  
 Automatic Capital Letter for 1st Letter???
Private Sub Text1_Change()
    If Len(Text1.Text) > 1 Then Exit Sub
    Text1.Text = UCase(Text1.Text)
    Text1.SelStart = 1
End Sub

Ronald


Quote:
> Hi i was wondering how i would make the first letter that i input into a
> text box turn automatically into a Capital Letter???

> Thanks in advance



Sun, 01 Sep 2002 03:00:00 GMT  
 Automatic Capital Letter for 1st Letter???


Quote:
>Hi i was wondering how i would make the first letter that i input into a
>text box turn automatically into a Capital Letter???

>Thanks in advance

Use VB's StrConv() function...

sText = StrConv(sText, vbProperCase)

Guy Gervais



Sun, 01 Sep 2002 03:00:00 GMT  
 Automatic Capital Letter for 1st Letter???
This doesn't work if there is already some text in the box which you've
highlighted prior to overwriting it with the new text. You need to omit the
If Then clause.
Quote:

>Private Sub Text1_Change()
>    On Error Resume Next
>    If Text1.Text <> "" Then
>        Text1.Text = UCase(Left(Text1.Text, 1)) & Right(Text1,
>Len(Text1.Text) - 1)
>        Text1.SelStart = Len(Text1.Text)
>    End If
>End Sub

>--
>Clint LaFever

>http://www.saic.com
>http://lafever.iscool.net (personal)
>(Home of the Code Depot Add-In)



>> Hi i was wondering how i would make the first letter that i input into a
>> text box turn automatically into a Capital Letter???

>> Thanks in advance



Wed, 18 Sep 2002 03:00:00 GMT  
 Automatic Capital Letter for 1st Letter???
Try using the masked edit control, you can make it so that all letters are cap
or all are lower, but i would imagine you can mix the two i know the commands
are somthing like slashes or somthing sorry i am so vague, but look in the MSDN
i know its {*filter*}but it will tell you what formatting to use.

Quote:
>This doesn't work if there is already some text in the box which you've
>highlighted prior to overwriting it with the new text. You need to omit the
>If Then clause.


>>Private Sub Text1_Change()
>>    On Error Resume Next
>>    If Text1.Text <> "" Then
>>        Text1.Text = UCase(Left(Text1.Text, 1)) & Right(Text1,
>>Len(Text1.Text) - 1)
>>        Text1.SelStart = Len(Text1.Text)
>>    End If
>>End Sub

>>--
>>Clint LaFever

>> http://www.*-*-*.com/
>> http://www.*-*-*.com/ (personal)
>>(Home of the Code Depot Add-In)



>>> Hi i was wondering how i would make the first letter that i input into a
>>> text box turn automatically into a Capital Letter???

>>> Thanks in advance

"The illiterate of the 21st century will not be those who cannot read and
write, but those who cannot learn, unlearn and relearn."--Alvin Toffer


Fri, 20 Sep 2002 03:00:00 GMT  
 Automatic Capital Letter for 1st Letter???
Try this:

Function First_Cap(work, ParamArray tbl()) As String
'----------------------------------------------------------------
'Purpose    capitalises the first letter in each word in a string
'           and allows for character table to allow for
'           e.g. mycompany(australia) to capitalise "a"
'23/09/98
'Modified by:
'Date:
'Details:
'----------------------------------------------------------------
Dim i As Integer
Dim x As Integer
Dim char As String
Dim txt As String
Dim temp As String
Dim boolChar As Boolean
Dim boolHasArray As Boolean
'--------------------------

On Error Resume Next

txt = Trim(work) 'get rid of outer spaces
txt = LCase(txt) 'set all to lower case

boolHasArray = (UBound(tbl) <> -1)

First_Cap = "" 'default

If (txt = "") Then

   Exit Function

Else

   For i = 1 To Len(txt)

      char = Asc(Mid$(txt, i, 1))

      '--------------------------------
      'if first char or flag set from
      'previous char
      '--------------------------------
      If (i = 1 Or boolChar) Then
         temp = temp & UCase$(Chr$(char))
         boolChar = False
      Else
         temp = temp & Chr$(char)
      End If

      '--------------------------------
      'check char for chr(32) or chars
      'in paramarray
      '--------------------------------
      If (char = 32) Then

         boolChar = True  'flag for next iteration

      ElseIf boolHasArray Then

         For x = LBound(tbl) To UBound(tbl)

            If (char = tbl(x)) Then
               boolChar = True 'flag for next iteration
               Exit For
            End If

         Next

      End If

   Next

End If

First_Cap = temp

End Function


Quote:
> Try using the masked edit control, you can make it so that all letters are
cap
> or all are lower, but i would imagine you can mix the two i know the
commands
> are somthing like slashes or somthing sorry i am so vague, but look in the
MSDN
> i know its {*filter*}but it will tell you what formatting to use.

> >This doesn't work if there is already some text in the box which you've
> >highlighted prior to overwriting it with the new text. You need to omit
the
> >If Then clause.


> >>Private Sub Text1_Change()
> >>    On Error Resume Next
> >>    If Text1.Text <> "" Then
> >>        Text1.Text = UCase(Left(Text1.Text, 1)) & Right(Text1,
> >>Len(Text1.Text) - 1)
> >>        Text1.SelStart = Len(Text1.Text)
> >>    End If
> >>End Sub

> >>--
> >>Clint LaFever

> >> http://www.*-*-*.com/
> >> http://www.*-*-*.com/ (personal)
> >>(Home of the Code Depot Add-In)



> >>> Hi i was wondering how i would make the first letter that i input into
a
> >>> text box turn automatically into a Capital Letter???

> >>> Thanks in advance

> "The illiterate of the 21st century will not be those who cannot read and
> write, but those who cannot learn, unlearn and relearn."--Alvin Toffer



Sat, 21 Sep 2002 03:00:00 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Automatic Capital Letter for 1st Letter???

2. Capital Letter Conversion

3. Capital letters in Excel

4. How to search for words with capital initial letters

5. Find Capital Letters

6. Allowing me to type chars with no number but Capital LETTERS

7. PROBLEM WITH CAPITAL LETTERS IN BASIC

8. How to search a string for Capital letters?

9. Help with a search for Capital letters???? Please

10. FileListbox that can show capital letters

11. Capital Letters

12. Allowing me to type chars with no number but Capital LETTERS

 

 
Powered by phpBB® Forum Software