Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I'm new with the VB.NET, I started to create an app that helps to manage a small store.
I had a problem that i wanna update only the first character in all Rows where the first character = "H" and keep the rest.

Thanks.
Posted
Updated 16-Dec-14 22:54pm
v2
Comments
DamithSL 17-Dec-14 4:51am    
first character of what? what you mean by field (Article)?
ID Bouhouch El Bachir 17-Dec-14 4:57am    
I had a table with 3 fields : ID,Code,Article.
I wanna update the first character in all Articles where they start with "H"
DamithSL 17-Dec-14 5:05am    
what is the column data type of Article?
ID Bouhouch El Bachir 17-Dec-14 5:10am    
The column data type of article --> hyperlink
I wanna update only the first character and keep the rest.

1 solution

Assuming it is a String, you may use a Function like the following:
VB
Private Shared Function ChangeFirst(s As String, c As Char) As String
  ChangeFirst = c + s.Substring(1)
End Function

Called, for instance, this way:
VB
Dim s As String = "XXX"
s = ChangeFirst(s, "A"c)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900