Dear friends,
I want to generate a unique number which increments for ex 123 with a combination of characters like for ex KN123 where only the digits should increment for ex the next unique number should be KN124 like that.. And at form load and after entry for that unique number and for the next entry it should show the next unique number .. how do i do that please tell me...
Thanks in advance.
Loading

Vilas GiteRank #951 · 2.1K reputationPosted May 30, 2011, 1:35 AM EDT
please check this... this is fulfill your requirment
VulpesRank #55 · 29.2K reputationPosted May 30, 2011, 1:40 AM EDT
class Form1 : Form // EDITED
{
private static string lastNumber = "KN123";
private string currentNumber;
public Form1()
{
InitializeComponent();
int index = lastNumber.IndexOfAny("0123456789".ToCharArray());
int last = int.Parse(lastNumber.Substring(index));
lastNumber = lastNumber.Substring(0, index) + (last + 1).ToString();
currentNumber = lastNumber;
}
// rest of Form1 code
}
If you want to keep track of instances created duing multiple runnings of your application, then you will need to save lastNumber to disk at the end of each running and then reload it at the start of the next running.
Kavita B135 reputationPosted May 30, 2011, 1:41 AM EDT
Thanks
I do not have word 2007 so not able to open ur .docx file... Can u give it in .doc format?
Vilas GiteRank #951 · 2.1K reputationPosted May 30, 2011, 1:45 AM EDT
Mayur GujrathiRank #666 · 3.6K reputationPosted May 30, 2011, 3:03 AM EDT
DECLARE
@ALPHA_VAL CHAR(1) , @INT_VAL VARCHAR(1000)
DECLARE @VAL INT =97, @VAL1 INT =1
WHILE @VAL <= 122
BEGIN
SET @VAL1=1
WHILE @VAL1 < 1000
BEGIN
SET @ALPHA_VAL = CHAR(@VAL)
SET @INT_VAL = CONVERT(CHAR,@VAL1)
SET @INT_VAL= @ALPHA_VAL + @INT_VAL
PRINT @INT_VAL
SET @VAL1 =@VAL1+1
END
SET
@VAL=@VAL+1
END
Vilas GiteRank #951 · 2.1K reputationPosted May 31, 2011, 2:23 AM EDT
Are you done it or not yet?