CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: name function

  1. #1
    Join Date
    Nov 1999
    Posts
    3

    name function

    I have a function that will return an inputted name in proper case as long as a middle initial is included. It fails if only a first name and last name is entered. Validation forces letters and spaces. Can anyone help with the needed code to display properly even if no middle initial is entered.

    CStr(Text2.Text)


  2. #2
    Join Date
    Dec 1999
    Location
    Israel
    Posts
    101

    Re: name function

    Try something like that:

    If Text2.Text <> "" Then MyText = MyText & CStr(Text2.Text)

    In this condition you'll check, if your textbox is not empty.

    Good Luck!


  3. #3
    Join Date
    Nov 1999
    Location
    Denver, CO
    Posts
    20

    Re: name function

    Kyler,

    Here is additional code for you to use.

    Dim strIn As String
    Dim astrIn() As String
    Dim strOut As String
    Dim I As Integer



    strIn = "allen d echo f g noakes"
    strIn = StrConv(strIn, vbProperCase)

    astrIn = Split(strIn, " ")

    For I = LBound(astrIn) To UBound(astrIn)

    If Len(astrIn(I)) = 1 Then
    astrIn(I) = astrIn(I) & "."
    End If

    strOut = strOut & " " & astrIn(I)
    Next

    Allen Noakes
    VB Programmer/Analyst
    Dames & Moore Group


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured