Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Accessing a settings variable

Status
Not open for further replies.

4getit

Programmer
Sep 15, 2006
8
US
I have a block of code on the start page of my application that checks the users settings file and performs some tasks. I then want to set a couple of those setting values to a variable that I can get the value of during the data service portion of my application. I can't seem to call them out of this class later on in the app. Am I not setting the session and userID values correctly? How can I be sure I can call those variables at anytime during my app? Here's the code.

public void isTrackingEnabled()
{
Properties.Settings settings = new Imsms.Zeus.WinClient.Properties.Settings();
if (settings.TrackingEnabled == "")
{
string message = "Do you want to enable Click Tracking? Your information will remain anonymous and be used only to improve the software functionality";
string caption = "Enable Click Tracking";
MessageBoxButtons buttons = MessageBoxButtons.YesNo;
MessageBoxIcon icon = MessageBoxIcon.Exclamation;
DialogResult result;

result = MessageBox.Show(message, caption, buttons, icon);

if (result == DialogResult.Yes)
{
settings.TrackingEnabled = "Yes";
settings.UserID = System.Guid.NewGuid().ToString();
settings.Session = 1;
settings.Save();
}
else
{
settings.TrackingEnabled = "No";
settings.Save();
}
}
else if (settings.TrackingEnabled == "Yes")
{
String userID = settings.UserID;
Int32 session = settings.Session + 1;

}
}
 
You really should create an object where you set properties on it for your ID's. zthere are many examples on google of how to do this.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top