I used a char array
char filename, and a char *extension = ".txt".
I used an unsigned int for the number. As the program looped around for another filename increment, the file_num++, of course.
iota() from ctype.h, was then used to put the number into the filename char array. Then I used strcat() from string.h, to add the .txt onto the end of the filename array. You need to include both ctype.h and string.h.
If you don't have itoa(), check your help files for things like ltoa() or stroi, etc. You can "peel" off the digits from the number and put them into the string by hand, but it's much more work.
Post up your attempt and we'll get you sorted out.
Edit: For a small number of numbered files, only:
Char's are just numbers with a very small range, so you can also increment the filename char's, directly:
The problem with this, is you have to handle every bit of the arithmetic, yourself (changing a 9 to a 10, leaving the zero there, and incrementing the adjacent element of the array, by one). If you have many numbers, forget this and use the way above.
For Each ctrl As Control In Me.Controls("pnlMainPanel").Controls
If ctrl.GetType Is GetType(System.Windows.Forms.Panel) Then
For Each subCtrl As Control In ctrl.Controls
If subCtrl.GetType Is GetType(System.Windows.Forms.TextBox) Then
If subCtrl.GetType Is ...