Skip to main content

Report Designer: Proper Case and Trimmed fields

Comments

4 comments

  • Zack Robison
    There are a few ways to do title case, the shortest in VB is probably with the StrConv builtin function (https://support.microsoft.com/en-us/help/312897/how-to-convert-string-to-lowercase-uppercase-or-title-proper-case-by-u) . StrConv(string, VbStrConv.ProperCase) What you probably want for your zips is the .Substring method (https://stackoverflow.com/questions/10148718/slicing-string-in-visual-basic) . ZIP.Substring(0,5)

     

     
    0
  • Permanently deleted user
    Hey Zack,

     

    Thanks so much for your time!

     

    So the substring of my ZIPCODE went great!

     

    I'm not having as much luck with the ProperCase for my STREETNAME field, tho.

     

    I have tried the following options:

     

    StrConv(STREETNAME, VbStrConv.ProperCase)   =   returns street name, all uppercase (no change)

     

    Console.WriteLine(StrConv(STREETNAME, VbStrConv.ProperCase))   =    returns error:  Control Script failed for control TextBox1 ,  Source=calc_STREETNAME

     

    Console.WriteLine(textInfo.ToTitleCase(STREETNAME)   =   retunrs error: Control Script failed for control TextBox1 , Source=calc_STREETNAME

     

    Where am I going wrong?

     

      

     

     
    0
  • Zack Robison

    Are you trying to access the console while running a report?  You're gonna have a bad time!

    I haven't looked too closely at the documentation, but I do notice that all of their pre-proper text is in lower case, perhaps you would try squeezing a .ToLower method in there before converting to proper case.

    I also found that the answer on the Stack post "How to camel case words that are uppercased" (https://stackoverflow.com/questions/5820488/vb-net-how-to-camel-case-words-that-are-uppercased) using the cultureinfo namespace also does this.

    0
  • Permanently deleted user
    You're a GENIOUS, Zack!  This Works:   

     

     

     

    System.Globalization.CultureInfo.CurrentCulture.TextInfo.ToTitleCase(STREETNAME.ToLower())

     

    Many thanks!  I owe you a fruit basket!

     

    User-added image

     

     
    0

Please sign in to leave a comment.