Click here to Skip to main content
15,897,187 members
Home / Discussions / C#
   

C#

 
AnswerRe: Please help with xml reading Pin
Srishti Mathur22-Jul-08 19:14
Srishti Mathur22-Jul-08 19:14 
QuestionThread problem Pin
Mogaambo22-Jul-08 18:36
Mogaambo22-Jul-08 18:36 
AnswerRe: Thread problem Pin
Elroy Dsilva22-Jul-08 22:04
Elroy Dsilva22-Jul-08 22:04 
QuestionMy sort of first program that doesn't work Pin
DFlat4Now22-Jul-08 17:38
DFlat4Now22-Jul-08 17:38 
AnswerRe: My sort of first program that doesn't work Pin
John Ad22-Jul-08 20:31
John Ad22-Jul-08 20:31 
AnswerRe: My sort of first program that doesn't work Pin
mark_w_22-Jul-08 22:17
mark_w_22-Jul-08 22:17 
Questionparent form --> MDIChild connection Pin
shadowhazard22-Jul-08 17:32
shadowhazard22-Jul-08 17:32 
AnswerRe: parent form --> MDIChild connection Pin
Mbah Dhaim22-Jul-08 23:24
Mbah Dhaim22-Jul-08 23:24 
usually I will use global application class that act as session in my application, the global class contains application global variables stored as list (usually i use sorted list). thus this variable can be accessed by other object in application
sample of global class like this

public static class GlobalApplication
{
 private static SortedList<string,> globalVars = new SortedList<string,>();

public static void AddGlobalVar(string variableName, object variableValue)
{
if (!globalVars.Keys.Contains(variableName.ToLower())
{
globalVars.Add(variableName.ToLower(), variableValue);
}

public static object GetGlobalVar(string variableName)
{
if (!globalVars.Keys.Contains(variableName.ToLower())
{
return null;
}
return globalVars[variableName.ToLower()];
}
}

}


by use that class u have to add your database connection or other object to store to global variable and access it within your application. i.e
GlobalApplication.AddGlobalVar("database connection", your.database.object)

YourDatabaseObject db = (GlobalApplication.GetGlobalVar("database connection") == null) ? null : (YourDatabaseObject)GlobalApplication.GetGlobalVar("database connection"); 


hope it helps

dhaim
programming is a hobby that make some money as side effect Smile | :)

QuestionHard Inheritance Questions (for me) Pin
Dirso22-Jul-08 12:53
Dirso22-Jul-08 12:53 
AnswerRe: Hard Inheritance Questions (for me) Pin
Luc Pattyn22-Jul-08 13:26
sitebuilderLuc Pattyn22-Jul-08 13:26 
AnswerRe: Hard Inheritance Questions (for me) Pin
PIEBALDconsult22-Jul-08 14:32
mvePIEBALDconsult22-Jul-08 14:32 
AnswerRe: Hard Inheritance Questions (for me) Pin
Dirso22-Jul-08 16:34
Dirso22-Jul-08 16:34 
AnswerRe: Hard Inheritance Questions (for me) Pin
Giorgi Dalakishvili22-Jul-08 21:32
mentorGiorgi Dalakishvili22-Jul-08 21:32 
GeneralRe: Hard Inheritance Questions (for me) Pin
Dirso23-Jul-08 3:50
Dirso23-Jul-08 3:50 
GeneralRe: Hard Inheritance Questions (for me) Pin
Giorgi Dalakishvili23-Jul-08 4:44
mentorGiorgi Dalakishvili23-Jul-08 4:44 
QuestionLockbits and 8-bit grayscale images Pin
gigahertz20522-Jul-08 12:39
gigahertz20522-Jul-08 12:39 
AnswerRe: Lockbits and 8-bit grayscale images Pin
Guffa22-Jul-08 13:39
Guffa22-Jul-08 13:39 
GeneralRe: Lockbits and 8-bit grayscale images Pin
gigahertz20522-Jul-08 15:26
gigahertz20522-Jul-08 15:26 
GeneralRe: Lockbits and 8-bit grayscale images Pin
Luc Pattyn22-Jul-08 15:42
sitebuilderLuc Pattyn22-Jul-08 15:42 
GeneralRe: Lockbits and 8-bit grayscale images Pin
gigahertz20522-Jul-08 15:50
gigahertz20522-Jul-08 15:50 
GeneralRe: Lockbits and 8-bit grayscale images Pin
Guffa23-Jul-08 4:33
Guffa23-Jul-08 4:33 
QuestionOpen (or focus) forms from listbox items Pin
nelsonpaixao22-Jul-08 12:34
nelsonpaixao22-Jul-08 12:34 
AnswerRe: Open (or focus) forms from listbox items Pin
Luc Pattyn22-Jul-08 13:29
sitebuilderLuc Pattyn22-Jul-08 13:29 
AnswerRe: Open (or focus) forms from listbox items Pin
nelsonpaixao23-Jul-08 14:06
nelsonpaixao23-Jul-08 14:06 
Questiondata insert mysql+c# Pin
SHINOJK22-Jul-08 12:09
SHINOJK22-Jul-08 12:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.