?
Solved

Resetting default value of text box at runtime – VB.Net, Visual Studio 2003, Windows Applications.

Posted on 2007-04-06
4
Medium Priority
?
275 Views
Last Modified: 2011-09-20
Hello

I’d like to have a user open my .exe Windows Application, type some text in a text box, hit a button which makes this text it’s default the next time the user opens the applications.

Is this possible without storing the default text in a text file?

Any suggestions would be appreciated.

Thanks.
Iain
0
Comment
Question by:IainTheVBALearner
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 67

Accepted Solution

by:
sirbounty earned 320 total points
ID: 18864840
You can store it in the AppSettings...

See: http://www.codeproject.com/netcf/cConfig.asp
0
 
LVL 3

Expert Comment

by:r1937
ID: 18867308
I'm not sure about VB2003
however In VS2005 you can double click "My Project" and in settings, type in the setting name, type and scope (per user or for all users).

To access/set these values:

My.Settings.MySetting = "Test Value"

These will be saved when the application closes if save my setings on shutdown is checked or use
My.Settings.Save
0
 
LVL 3

Assisted Solution

by:r1937
r1937 earned 180 total points
ID: 18867369
Or use registry to save application.

Imports Microsoft.Win32
to open----------
        Dim RegKey As RegistryKey
        Try
            RegKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\MyAppName", True)
            txtName.Text = RegKey.GetValue("Name")
            txtAddress.Text = RegKey.GetValue("Address")
            txtTelNo.Text = RegKey.GetValue("TelNo")
        Catch
            'No Registry Entries
        End Try
to save----------
           Try
                RegKey = Registry.CurrentUser.OpenSubKey("SOFTWARE", True)
                RegKey.CreateSubKey("MyAppName")
                RegKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\MyAppName", True)
                RegKey.SetValue("Name", txtName.Text)
                RegKey.SetValue("Address", txtAddress.Text)
                RegKey.SetValue("TelNo", txtTelNo.Text)
            Catch
                MsgBox("Error")
            End Try
0
 
LVL 3

Author Comment

by:IainTheVBALearner
ID: 18910231
What a palava....thanks for the comments!
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question