Set Propercase() On All Words Or Just the First Word

Category:
C#, VB.NET, ASP.NET
Type:
Snippets
Difficulty:
Beginning
Author:
Anonymous

Version Compatibility: Visual Basic.NET

More information:
Built-in functions in VB.NET offer the ProperCase() function to set initial caps. However, this function capitalizes every word if your string contains a sentence. The properCase() function submitted here accepts a boolean argument to dictate whether to set initial caps on every word, or just the first word. A form_load function is included to demo this code. Simply paste this snippet into your VB.NET class and press F5 to run it.

Instructions: Copy the declarations and code below and paste directly into your VB project.

Declarations:

Code: