Community
Civil 3D Customization
Welcome to Autodesk’s AutoCAD Civil 3D Forums. Share your knowledge, ask questions, and explore popular AutoCAD Civil 3D Customization topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

retain values textbox windows form in the same session

5 REPLIES 5
Reply
Message 1 of 6
wang890
369 Views, 5 Replies

retain values textbox windows form in the same session

right now all my forms with input textbox once you close the form upon running the program in civil 3d or autocad and start the command to show the form again resets to default windows form values set in visual studio. what's the easiest way to have the last user input value stay there each time you run the form again?

 

before i done this using "settings" in visual studio which stores and retrieve property settings. but it's a little annoying to set one by one.

Stantec
Dell Precision 5530, Prism M320PU, C3D 14/17/19
5 REPLIES 5
Message 2 of 6
wang890
in reply to: wang890

some guy answered and then removed the answer.

 

no i mean to retain values in the text box like input of length, radius, stuff like which is used for calculations. user wants to be able to run the form again with the last input.

 

anybody?

Stantec
Dell Precision 5530, Prism M320PU, C3D 14/17/19
Message 3 of 6
tyronebk
in reply to: wang890

I removed my post because I misread your question and therefore provided a useless answer.

 

I would just use a singleton class, structure, or object array/list/dictionary. Just create it with your default settings preloaded, then when the form first loads, pull your values from it. When the form closes, write the values back to it. Next time the form opens during the session, since the singleton already exists, your form will populate with the previously stored values.

Message 4 of 6

The code to do what you want may be found in the source code for the free version of the SincPac. It either saves to the drawing or to the registry and then you pull the values from it. This way it stays around. You can also create a singleton like was previously mentioned to store the values and when the form is created pull the values from it. 

Civil Reminders
http://blog.civil3dreminders.com/
http://www.CivilReminders.com/
Alumni
Message 5 of 6

As Chris suggested, a singleton will only store value for the current session of AutoCAD/Civil 3D (since that's what you specified in your title).

 

If you were previously using the application settings route through visual studio, those are typically persistent settings (except they are reset every time the host application version changes) and can be retrieved between sessions. A singleton will not replicate that functionality. Kean has a few posts covering saving data in the registry and drawings. I believe the SincPac settings utilize most of these ideas.

Message 6 of 6
wang890
in reply to: tyronebk

thanks guys. i end up using the settings. wans't too bad.

 

singleton that is news to me. definitely look into that later.

 

see picture of what i did.

Stantec
Dell Precision 5530, Prism M320PU, C3D 14/17/19

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Rail Community


 

Autodesk Design & Make Report