Hi can someone give me the code how i make the first and last word of a string to Propr case
The folowing gives all words to proper case

Dim plaats As String = Replace(TextBox1.Text, "'", "''")
plaats = StrConv(plaats, VbStrConv.ProperCase)

I want, shall we say: "ohe en laak" to "Ohe en Laak" or "mülheim an der ruhr" To "Mülheim an der Ruhr"
Thanks in advise John

Recommended Answers

All 4 Replies

Split the sentence with space and store it in an array then convert to proper case of the first and last element of that array. After that join the array elements with space.

Can you give code please. I am not a hero with arrays.

            Dim vplaats() As String = Split(Replace(TextBox1.Text, "'", "''"), " ")
            vplaats(0) = StrConv(vplaats(0), VbStrConv.ProperCase)
            vplaats(vplaats.Length - 1) = StrConv(vplaats(vplaats.Length - 1), VbStrConv.ProperCase)
            Dim platts As String = Join(vplaats, " ")

Thanks for the help that works great

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.