Results 1 to 5 of 5

Thread: FYI - You can use VB specific functions in any C# project

  1. #1

    Thread Starter
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256

    Thumbs up FYI - You can use VB specific functions in any C# project

    I just realized that you can use vb specific functions in C#.

    I am writing a CD cataloging program and all the title name were upper case in the Database.

    I was looking for a function to convert the titles to proper case and unfortunately C# does not have a function to convert strings to proper case, so I had to use the on from VB.NET.

    by using

    using Microsoft.VisualBasic; or just qualifying the entire name space to use the function like this

    Microsoft.VisualBasic.Strings.StrConv

    .Net is off the hook
    Dont gain the world and lose your soul

  2. #2
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,539
    c# does have the function
    Code:
    string mybiatch = "blah blah";
    bybiatch = mybiatch.toUpper();

  3. #3

    Thread Starter
    Frenzied Member DevGrp's Avatar
    Join Date
    Nov 2001
    Location
    Charlotte, NC
    Posts
    1,256
    I know about the toUpper function. I was'nt refering to that one.

    VB has a function call StrConv.

    This is what I wanted to do.

    In CD database, the CD Titles were entered using upper case.

    eg. "COMPACT DISK"

    I wanted "Compact Disk"

    StrConv converts the first letter of each word to uppercase and the rest of the letters lowercase.

    That is what is refered to as propercase.
    Dont gain the world and lose your soul

  4. #4
    Hyperactive Member thinktank2's Avatar
    Join Date
    Nov 2001
    Location
    Arctic
    Posts
    272

    Re: FYI - You can use VB specific functions in any C# project

    Originally posted by DevGrp
    I just realized that you can use vb specific functions in C#.

    I am writing a CD cataloging program and all the title name were upper case in the Database.

    I was looking for a function to convert the titles to proper case and unfortunately C# does not have a function to convert strings to proper case, so I had to use the on from VB.NET.

    by using

    using Microsoft.VisualBasic; or just qualifying the entire name space to use the function like this

    Microsoft.VisualBasic.Strings.StrConv

    .Net is off the hook
    Wow !!! This is great !

  5. #5
    Frenzied Member Jop's Avatar
    Join Date
    Mar 2000
    Location
    Amsterdam, the Netherlands
    Posts
    1,986
    .NET does have a way to convert to Propercase (now called Titlecase) in C#...
    I wrote a quick example for ya!

    be sure to add
    PHP Code:
    using System.Globalization
    PHP Code:
                CultureInfo ci = new CultureInfo("en"); //Create a new CultureInfo class for the english language
                
    TextInfo cc ci.TextInfo//Get the textinfo class from the CultureInfo object
                
    MessageBox.Show(cc.ToTitleCase("helLo joP hOw ArE yOU?")); 
    Jop - validweb.nl

    Alcohol doesn't solve any problems, but then again, neither does milk.

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