c# - I need to create a list of numbers in text file -


hello please have program create numbers in text file based on textboxes value there 3 textboxes first typing not changed number textbox2 typing first number , textbox3 typing last number in output program give me

015 100
015 101
015 102
015 103
015 104
015 105
015 106
015 107
015 108

but int text box i'm typed first :0000100 last 0000108 , 015 fixed number , me need in text file

015 0000100
015 0000101
015 0000102
015 0000103
015 0000104
015 0000105
015 0000106
015 0000107
015 0000108

and code of button

int a, b;    = convert.toint32(textbox2.text); b = convert.toint32(textbox3.text);  system.io.streamwriter objwriter; string fm = @"c:\users\hp pavilion\desktop\text.txt"; objwriter = new system.io.streamwriter(fm);  int i; (i = convert.toint32(textbox2.text); <= convert.toint32(textbox3.text); i++) {     objwriter.write(textbox1.text + " " + + "\r\n");     progressbar1.value = (100 / (b - a)) * i; } objwriter.close(); 

thank helping me

i.tostring("d7") means:

please convert number leading 0 in length of 7 characters.

from the decimal ("d") format specifier

the precision specifier indicates minimum number of digits desired in resulting string. if required, number padded zeros left produce number of digits given precision specifier. if no precision specifier specified, default minimum value required represent integer without leading zeros.

objwriter.write(textbox1.text + i.tostring("d7") + environment.newline); 

Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -