Click here to Skip to main content
15,897,519 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
In my window application i want to format A1 as A0001. How to do that?
Posted

1 solution

VB
Dim ID As String = "A1"
Dim a As String = ID.Substring(0, 1)
Dim num As String = ID.Substring(1, 1)

[EDIT]
Dim K AS Integer = Integer.Parse(num)
Dim formatVal As String = String.Format("{0:0000}", K)
[/EDIT]
Dim final As String = a + formatVal
 
Share this answer
 
v3
Comments
jai_mca 6-Sep-14 2:31am    
Thanks Dilan.but that formatVal doesn't return formated value..it return the actual value
Dilan Shaminda 6-Sep-14 2:42am    
sry my mistake.i have updated the answer :-)
jai_mca 6-Sep-14 2:58am    
Thanks a lot Dilan..it's working :)
Dilan Shaminda 6-Sep-14 2:59am    
you are welcome :-) Please accept it as an answer if it has solved your issue :-)

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