you can use this
Go to Project -> Add Class. Name your class Variables. Here is an example:
using System;
using System.Collections.Generic;
using System.Text;
namespace YourNamespaceName
{
public class Variables
{
public static string Name { get; set; }
public static string Address { get; set; }
}
}
Now you can set and access these properties in any of your windows forms and can save it to database.
Access it like Variables.Name="jay"
You can also use setting application settings
=>right-click on the project => select the settings tab and add values to it.
To access this values, call:
string value = WindowsApplication1.Properties.Settings.Default.Setting1;
Setting the values:
WindowsApplication1.Properties.Settings.Default.Setting1 = "newValue";
WindowsApplication1.Properties.Settings.Default.Save();
OR else you can use Singleton class
http://msdn.microsoft.com/en-us/library/ms998558
Kind Regards,
Jay
Vijayar, if this helps please login to Mark As Answer. | Alert Moderator