takes the first three characters of lastID ('fps' here).
'id' is the integer that we've already parsed from the final four characters of lastID. So, this expression:
(id + 1).ToString("D4")
adds one to it and then expresses the result as a string using the 'D4' format. This format fills out the integer to 4 digits using leading zeros. So 1 becomes 0001.
We then concatenate these two string expressions using the '+' operator and assign the result back to lastID.
So, if lastID originally contained fps0000, it will now contain fps0001 and so on.
sandhya PatelPosted Jul 10, 2014, 11:50 PM
VulpesPosted Jul 10, 2014, 4:17 PM
sandhya PatelPosted Jul 10, 2014, 3:07 PM
i cant get the meaning of
lastID = lastID.Substring(0, 3) + (id + 1).ToString("D4");
pls help
VulpesPosted Jul 10, 2014, 9:33 AM
You may also need to consider what to do if you ever get to fps9999 so that code can be written to deal with further increments after that.
sandhya PatelPosted Jul 10, 2014, 4:40 AM
actually i want to generate it as an autogenerate id.....and to insert to database field during button click...
Shweta LodhaPosted Jul 10, 2014, 4:39 AM
http://www.c-sharpcorner.com/Forums/Thread/260953/alphanumeric-value-like-fps1000-is-assigning-to-a-variable.aspx
Please close one of these post
Shweta LodhaPosted Jul 10, 2014, 4:36 AM
String count;
count=fps1000;