By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,346 Members | 2,331 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,346 IT Pros & Developers. It's quick & easy.

Retaining Last Value in the Text Boxes in VB.NET

P: n/a
How do you retain the last value the user keyed in a text
box? I should be able to show the values when the user
runs the executable for the second time.

Appreciate help.
Suresh
Jul 19 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Suresh,

See, there is no single "best" option. I could just give some examples on
which way fits best the nature of the application:

a) An "Options" dialog box of a desktop application. Usually settings are
stored in the registry or in a configuration file. Please refer to the
Microsoft.Win32.Registry class and to the System.Configuration namespace for
more detailed information and examples.

b) A "Preferences" web page of a Web application. Web applications most
often work with some kind of database and usually store all information
within the database. Please refer to the System.Data namespace documentation
for more info and examples.

c) Customer details in a desktop CRM application. Such complex applications
also usually rely on some kind of database or structured storage.

P.S. In fact, the question you are asking is too "broadband". I suggest you
are facing a particular problem, and if you would describe things you want
to achieve, I think the community could came up with more detailed advice.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Suresh Kumaran" <ku********@hotmail.com> wrote in message
news:0e****************************@phx.gbl...
Dmitriy,

What would be the best option to do this? Do you have a
sample coding on this?

Thanks in advance,

Suresh


Jul 19 '05 #2

P: n/a
Dmitriy,

Thanks for your reply.

All right, here's what I want. My application is being
developed using VB.NET The design is this.

A. Form 1 designed for user to enter the part number. Form
1 has two buttons "Okay" and "Cancel" If the user
clicks "Okay", a textfile is validated and read for the
details of the partnumber,and the part number is passed as
aparameter to form 2.

B. Form 2 shows all other details of the partnumber such
as drawing date, approved date, description etc. These
values are placed on Form 2. Three button are availableon
form 2, "SAVE" "CANCEL" "EXIT" The user is allowed to
change any other details of the part number other than the
part number. User changes any details saves and exit the
application.

The requirement is that, if the user comes back the
application the second time around. I should be able to
show the partnumber he/she was working on in the Form 1.

How do I retain this value and show it?

Hope I have explained.

Suresh

-----Original Message-----
Suresh,

See, there is no single "best" option. I could just give some examples onwhich way fits best the nature of the application:

a) An "Options" dialog box of a desktop application. Usually settings arestored in the registry or in a configuration file. Please refer to theMicrosoft.Win32.Registry class and to the System.Configuration namespace formore detailed information and examples.

b) A "Preferences" web page of a Web application. Web applications mostoften work with some kind of database and usually store all informationwithin the database. Please refer to the System.Data namespace documentationfor more info and examples.

c) Customer details in a desktop CRM application. Such complex applicationsalso usually rely on some kind of database or structured storage.
P.S. In fact, the question you are asking is too "broadband". I suggest youare facing a particular problem, and if you would describe things you wantto achieve, I think the community could came up with more detailed advice.
--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Suresh Kumaran" <ku********@hotmail.com> wrote in message
news:0e****************************@phx.gbl...
Dmitriy,

What would be the best option to do this? Do you have a
sample coding on this?

Thanks in advance,

Suresh


.

Jul 19 '05 #3

P: n/a
Dmitriy,

Thanks for your reply. My choice was a text file too. Just
curious to know how do you code the values to the
registry? Do you have a sample. 'Cos I have not written
any codes before to write to the registry. Also won't the
registry cause a security issue when deploying the project?

Suresh
-----Original Message-----
Suresh,

Now I see. I think registry or a simple text file would be the best choicehere. When the user closes the Form 1, read the text box value and save itto the registry/file with the appropriate Framework classes. And upon Form 1start-up, check whether you have previously stored value and pre-populatethe text box.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Suresh Kumaran" <ku********@hotmail.com> wrote in message
news:1a****************************@phx.gbl...
Dmitriy,

Thanks for your reply.

All right, here's what I want. My application is being
developed using VB.NET The design is this.

A. Form 1 designed for user to enter the part number. Form 1 has two buttons "Okay" and "Cancel" If the user
clicks "Okay", a textfile is validated and read for the
details of the partnumber,and the part number is passed as aparameter to form 2.

B. Form 2 shows all other details of the partnumber such
as drawing date, approved date, description etc. These
values are placed on Form 2. Three button are availableon form 2, "SAVE" "CANCEL" "EXIT" The user is allowed to change any other details of the part number other than the part number. User changes any details saves and exit the
application.

The requirement is that, if the user comes back the
application the second time around. I should be able to
show the partnumber he/she was working on in the Form 1.

How do I retain this value and show it?

Hope I have explained.

Suresh

>-----Original Message-----
>Suresh,
>
>See, there is no single "best" option. I could just give
some examples on
>which way fits best the nature of the application:
>
>a) An "Options" dialog box of a desktop application.

Usually settings are
>stored in the registry or in a configuration file.
Please refer to the
>Microsoft.Win32.Registry class and to the

System.Configuration namespace for
>more detailed information and examples.
>
>b) A "Preferences" web page of a Web application. Web

applications most
>often work with some kind of database and usually store

all information
>within the database. Please refer to the System.Data

namespace documentation
>for more info and examples.
>
>c) Customer details in a desktop CRM application. Such

complex applications
>also usually rely on some kind of database or
structured storage.
>
>P.S. In fact, the question you are asking is

too "broadband". I suggest you
>are facing a particular problem, and if you would

describe things you want
>to achieve, I think the community could came up with
more detailed advice.
>
>--
>Dmitriy Lapshin [C# / .NET MVP]
>X-Unity Test Studio
>http://x-unity.miik.com.ua/teststudio.aspx
>Bring the power of unit testing to VS .NET IDE
>
>"Suresh Kumaran" <ku********@hotmail.com> wrote in

message >news:0e****************************@phx.gbl...
>> Dmitriy,
>>
>> What would be the best option to do this? Do you have a >> sample coding on this?
>>
>> Thanks in advance,
>>
>> Suresh
>
>.
>


.

Jul 19 '05 #4

P: n/a
"Suresh Kumaran" <ku********@hotmail.com> wrote in news:1a2c01c372e2
$4****************@phx.gbl:
Dmitriy,

Thanks for your reply.

All right, here's what I want. My application is being
developed using VB.NET The design is this.

A. Form 1 designed for user to enter the part number. Form
1 has two buttons "Okay" and "Cancel" If the user
clicks "Okay", a textfile is validated and read for the
details of the partnumber,and the part number is passed as
aparameter to form 2.

B. Form 2 shows all other details of the partnumber such
as drawing date, approved date, description etc. These
values are placed on Form 2. Three button are availableon
form 2, "SAVE" "CANCEL" "EXIT" The user is allowed to
change any other details of the part number other than the
part number. User changes any details saves and exit the
application.

The requirement is that, if the user comes back the
application the second time around. I should be able to
show the partnumber he/she was working on in the Form 1.

How do I retain this value and show it?

Hope I have explained.

Suresh


I wouldn't use a "simple text file". Use an Xml file. Do this the same
way as I descibed in your question about "Most Recent Document".

--
Michael Lang, MCSD
See my .NET open source projects
http://sourceforge.net/projects/colcodegen/ (simple code generator)
http://sourceforge.net/projects/dbobjecter (database app code generator)
http://sourceforge.net/projects/genadonet ("generic" ADO.NET)

Jul 19 '05 #5

P: n/a
No I don't have a sample, but just look at the Microsoft.Win32.Registry
class documentation in the MSDN - I beleive there are several samples. As
for security issues, your code will need to be granted a RegistryPermission
with appropriate access rights. This is usually not a problem for desktop
applications running on a local machine, though.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Suresh Kumaran" <ku********@hotmail.com> wrote in message
news:1b****************************@phx.gbl...
Dmitriy,

Thanks for your reply. My choice was a text file too. Just
curious to know how do you code the values to the
registry? Do you have a sample. 'Cos I have not written
any codes before to write to the registry. Also won't the
registry cause a security issue when deploying the project?

Suresh
-----Original Message-----
Suresh,

Now I see. I think registry or a simple text file would

be the best choice
here. When the user closes the Form 1, read the text box

value and save it
to the registry/file with the appropriate Framework

classes. And upon Form 1
start-up, check whether you have previously stored value

and pre-populate
the text box.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"Suresh Kumaran" <ku********@hotmail.com> wrote in message
news:1a****************************@phx.gbl...
Dmitriy,

Thanks for your reply.

All right, here's what I want. My application is being
developed using VB.NET The design is this.

A. Form 1 designed for user to enter the part number. Form 1 has two buttons "Okay" and "Cancel" If the user
clicks "Okay", a textfile is validated and read for the
details of the partnumber,and the part number is passed as aparameter to form 2.

B. Form 2 shows all other details of the partnumber such
as drawing date, approved date, description etc. These
values are placed on Form 2. Three button are availableon form 2, "SAVE" "CANCEL" "EXIT" The user is allowed to change any other details of the part number other than the part number. User changes any details saves and exit the
application.

The requirement is that, if the user comes back the
application the second time around. I should be able to
show the partnumber he/she was working on in the Form 1.

How do I retain this value and show it?

Hope I have explained.

Suresh
>-----Original Message-----
>Suresh,
>
>See, there is no single "best" option. I could just give some examples on
>which way fits best the nature of the application:
>
>a) An "Options" dialog box of a desktop application.
Usually settings are
>stored in the registry or in a configuration file. Please refer to the
>Microsoft.Win32.Registry class and to the
System.Configuration namespace for
>more detailed information and examples.
>
>b) A "Preferences" web page of a Web application. Web
applications most
>often work with some kind of database and usually store
all information
>within the database. Please refer to the System.Data
namespace documentation
>for more info and examples.
>
>c) Customer details in a desktop CRM application. Such
complex applications
>also usually rely on some kind of database or structured storage.
>
>P.S. In fact, the question you are asking is
too "broadband". I suggest you
>are facing a particular problem, and if you would
describe things you want
>to achieve, I think the community could came up with more detailed advice.
>
>--
>Dmitriy Lapshin [C# / .NET MVP]
>X-Unity Test Studio
>http://x-unity.miik.com.ua/teststudio.aspx
>Bring the power of unit testing to VS .NET IDE
>
>"Suresh Kumaran" <ku********@hotmail.com> wrote in message >news:0e****************************@phx.gbl...
>> Dmitriy,
>>
>> What would be the best option to do this? Do you have a >> sample coding on this?
>>
>> Thanks in advance,
>>
>> Suresh
>
>.
>


.


Jul 19 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.