![]() |
|
|||||||
| Windows Forms Discussion related to Winforms application development |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi all!
I have a question about how to auto generate the next id number. In my form, I have 5 radiobuttons and one Message ID textbox. When I click on the first radiobutton, the number 1000 will appear in the MsgID textbox, so what I want to achieve is when 1000 is used, and when i close my form and open again, and select the 1st radiobutton, it will show 1001 instead of 1000. Also when I select the 2nd radiobutton, the number 2000 will appear in the MsgID textbox, so likewise how do I get the next available id when 2000 is used? Thank you very much in advance!!! |
|
|||
|
Hello.
Shall this be kept if the form closes, or if the program closes? First would a global variable. Second would put you in the need to save the variable 'somewhere'. You can use My.Settings for this, you could use a XML, INI or plain Textfile for it. Bobby |
|
|||
|
First you need to decide on where you are going to save the current Id, text file, database, .dat file. Then when you load the form you need to parse what ever file you have decided to use, apply the current number to a session variable and then just increment it each time you push your radio button.
Making any sense?? If not let me know and i'll post some psuedo-code. |
|
|||
|
Quote:
|
|
|||
|
Quote:
|
|
|||
|
Incrementing the variable would be done like so...
Code:
YourVariable += 1 |
|
|||
|
Yeap it has an auto increment value of 1. But i want it to be displayed in the textbox. Like if id 1000 is used, then the next available will be 1001 and it will be displayed in the textbox. And if i close the program, and open it again, it will show 1001. Thought of using the incrementing the variable, but i don't know how to implement it.
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|