473,786 Members | 2,404 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is there a function that will Capitalize words in a string?

Hi all. Checked the docs and all I can find is UCase but that will convert
everything to upper. What I want is when my users enter say a name into a
text box I want to just upper the first char for them if they forget to.

TIA

Robert
Jun 25 '07 #1
7 8408
Robert,

VB's StrConv function will do that. For example:

StudentName = StrConv(Student Name , VbStrConv.Prope rCase)

I don't know of a ".Net" way of accomplishing the same thing.

Kerry Moorman
"Robert Johnson" wrote:
Hi all. Checked the docs and all I can find is UCase but that will convert
everything to upper. What I want is when my users enter say a name into a
text box I want to just upper the first char for them if they forget to.

TIA

Robert
Jun 25 '07 #2
Kerry Moorman wrote:
Robert,

VB's StrConv function will do that. For example:

StudentName = StrConv(Student Name , VbStrConv.Prope rCase)

I don't know of a ".Net" way of accomplishing the same thing.
For ProperCase, the ".NET" way is exactly the same as VB6, no difference.

The following is from VB2005 Help -

Visual Basic 6.0 Visual Basic 2005 Equivalent
vbUpperCase VbStrConv.Upper Case

vbLowerCase VbStrConv.Lower Case

vbProperCase VbStrConv.Prope rCase

vbWide VbStrConv.Wide

vbNarrow VbStrConv.Narro w

vbKatakana VbStrConv.Katak ana

vbHiragana VbStrConv.Hirag ana

vbUnicode No equivalent constant. You can achieve the same functionality
by using the Convert method.

vbFromUnicode No equivalent

ShaneO

There are 10 kinds of people - Those who understand Binary and those who
don't.
Jun 25 '07 #3

"Robert Johnson" <jo*******@sbcg lobal.netwrote in message
news:eB******** ******@TK2MSFTN GP03.phx.gbl...
Hi all. Checked the docs and all I can find is UCase but that will convert
everything to upper. What I want is when my users enter say a name into a
text box I want to just upper the first char for them if they forget to.
Dim x As String = Textbox1.Text.S ubstring(1).ToU pper

You can play it anyway you want with a function of your own making or
whatever to return the string with the first character in upper case.

Function 1stCharUpper(ct rl as Textbox)

do what you have to do in the manipulation of the string.

dim x as string = ctrl.Text.Subst ring(1).ToUpper

return x = x & ctrl.text.subst ring(2, length)

end function

Jun 25 '07 #4
Thank you Kerry

Robert
"Kerry Moorman" <Ke**********@d iscussions.micr osoft.comwrote in message
news:B8******** *************** ***********@mic rosoft.com...
Robert,

VB's StrConv function will do that. For example:

StudentName = StrConv(Student Name , VbStrConv.Prope rCase)

I don't know of a ".Net" way of accomplishing the same thing.

Kerry Moorman
"Robert Johnson" wrote:
>Hi all. Checked the docs and all I can find is UCase but that will
convert
everything to upper. What I want is when my users enter say a name into a
text box I want to just upper the first char for them if they forget to.

TIA

Robert

Jun 26 '07 #5
Thank you ShaneO

Robert
"ShaneO" <sp****@optusne t.com.auwrote in message
news:46******** *************** @news.optusnet. com.au...
Kerry Moorman wrote:
>Robert,

VB's StrConv function will do that. For example:

StudentName = StrConv(Student Name , VbStrConv.Prope rCase)

I don't know of a ".Net" way of accomplishing the same thing.

For ProperCase, the ".NET" way is exactly the same as VB6, no difference.

The following is from VB2005 Help -

Visual Basic 6.0 Visual Basic 2005 Equivalent
vbUpperCase VbStrConv.Upper Case

vbLowerCase VbStrConv.Lower Case

vbProperCase VbStrConv.Prope rCase

vbWide VbStrConv.Wide

vbNarrow VbStrConv.Narro w

vbKatakana VbStrConv.Katak ana

vbHiragana VbStrConv.Hirag ana

vbUnicode No equivalent constant. You can achieve the same functionality
by using the Convert method.

vbFromUnicode No equivalent

ShaneO

There are 10 kinds of people - Those who understand Binary and those who
don't.

Jun 26 '07 #6
Thank you M. Arnold

Robert
"Mr. Arnold" <MR. Ar****@Arnold.c omwrote in message
news:uj******** ******@TK2MSFTN GP04.phx.gbl...
>
"Robert Johnson" <jo*******@sbcg lobal.netwrote in message
news:eB******** ******@TK2MSFTN GP03.phx.gbl...
>Hi all. Checked the docs and all I can find is UCase but that will
convert everything to upper. What I want is when my users enter say a
name into a text box I want to just upper the first char for them if they
forget to.

Dim x As String = Textbox1.Text.S ubstring(1).ToU pper

You can play it anyway you want with a function of your own making or
whatever to return the string with the first character in upper case.

Function 1stCharUpper(ct rl as Textbox)

do what you have to do in the manipulation of the string.

dim x as string = ctrl.Text.Subst ring(1).ToUpper

return x = x & ctrl.text.subst ring(2, length)

end function

Jun 26 '07 #7
Kerry,

Probably you mean with the .Net way. A way in the .Net namespace System.Net,
there is not, this is in the .Net namespace VisualBasic.

Cor

"Kerry Moorman" <Ke**********@d iscussions.micr osoft.comschree f in bericht
news:B8******** *************** ***********@mic rosoft.com...
Robert,

VB's StrConv function will do that. For example:

StudentName = StrConv(Student Name , VbStrConv.Prope rCase)

I don't know of a ".Net" way of accomplishing the same thing.

Kerry Moorman
"Robert Johnson" wrote:
>Hi all. Checked the docs and all I can find is UCase but that will
convert
everything to upper. What I want is when my users enter say a name into a
text box I want to just upper the first char for them if they forget to.

TIA

Robert

Jun 26 '07 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
20067
by: Rick | last post by:
For some reason my function to capitalize the first letter in a string and keep all the other letters lowercase isn't working. This is what I have. string convname(string name) { int len; len = name.length(); name = toupper(name); for(int i = 0; i < len; i++)
4
2673
by: MLH | last post by:
The following function declaration confuses me... Public Function IsEMailAddress(ByVal sEmail As String, Optional ByRef sReason As String) As Boolean I tried pasting it and its code into an Access 2.0 module. I was unsuccessful. I had to remove the following... "Public" "Optional ByRef" "As Boolean"
2
4678
by: Yuan Zhong | last post by:
hello all, not sure if it's appropriate to post here. If not, I am sorry and please direct me to the right groups. Thanks. I write this function to permute a string. e.g. if the input string is "abc", I am expecting to see the output: "abc", "acb", "bac", "bca", "cab", "cba" there is n! output for a string of size(n). Here is my code fragment, Can anyone points out how to improve my code so that I get the right output. You can see the...
1
3266
by: The_Kingpin | last post by:
Hi all, I need to make a function that convert a string into a certain format. Here what are the restriction: -The first letter of the first and last name must be uppercase. -If a first name contains only 1 character, a '.' must follow the char. -If we find a character that isn't a letter (.&*-), we must swap it for a '/' and add the correct spaces. I tried making a function but my switch seems to have an error. If anyone
7
3640
by: Li Pang | last post by:
Hi, I'd like to know how to call a sub/function bu using a string containing its name, as an example as follow: Sub Main() Dim name As String = "TestMe()" ' need help here End Sub
3
4872
by: ashok | last post by:
Hi, I need a function that will divide text from mysql in 2 parts, so that I can display first half in one column and second half in second column. I can't find what function will do this job. Here is part of what I have. $myrow = mysql_fetch_assoc($rsindexpage); //function wordcount $wc = str_word_count($myrow); $half = ($wc/2);
6
3948
by: Xernoth | last post by:
Hi, I have an exercise that requests the following: Write a function that reads words from an input stream and stores them in a vector. Use that function both to write programs that count the number of words in the input, and to count how many times each word occurred.
11
2868
by: dolphin | last post by:
Hi All! I have a question that how to call a function just using a string. For example There is a .cpp file named a.cpp.There are some functions::fun1() fun2() fun3(). I have another fucntion void funcall( char *pch). if I pass a argument char* p1="fun1" .How do I call the function fun1() using that string "fun1"that I pass.
0
1642
by: John | last post by:
Hi I have written a function to split a string into sub strings of a given fixed max length. This is useful for example in breaking a long message into multiple strings of up to 160 characters to be sent as individual SMS. I am posting the function here in case its useful for someone. Regards
0
9647
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10108
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9960
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7510
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6744
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5397
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3668
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.