Click here to Skip to main content
16,005,241 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionVB.Net Populate SQL Data to textbox upon Form Load Pin
jon237128-Aug-12 16:44
jon237128-Aug-12 16:44 
AnswerRe: VB.Net Populate SQL Data to textbox upon Form Load Pin
Wes Aday28-Aug-12 17:05
professionalWes Aday28-Aug-12 17:05 
AnswerRe: VB.Net Populate SQL Data to textbox upon Form Load Pin
Richard MacCutchan28-Aug-12 21:51
mveRichard MacCutchan28-Aug-12 21:51 
Questionprogramming G510 Pin
JR21227-Aug-12 20:38
JR21227-Aug-12 20:38 
AnswerRe: programming G510 Pin
Eddy Vluggen27-Aug-12 23:08
professionalEddy Vluggen27-Aug-12 23:08 
GeneralRe: programming G510 Pin
JR21227-Aug-12 23:32
JR21227-Aug-12 23:32 
GeneralRe: programming G510 Pin
Eddy Vluggen27-Aug-12 23:52
professionalEddy Vluggen27-Aug-12 23:52 
GeneralRe: programming G510 Pin
JR21228-Aug-12 7:24
JR21228-Aug-12 7:24 
GeneralRe: programming G510 Pin
Eddy Vluggen28-Aug-12 7:43
professionalEddy Vluggen28-Aug-12 7:43 
GeneralRe: programming G510 Pin
JR21228-Aug-12 8:09
JR21228-Aug-12 8:09 
GeneralRe: programming G510 Pin
Eddy Vluggen28-Aug-12 8:34
professionalEddy Vluggen28-Aug-12 8:34 
QuestionAddHandler and RemoveHandler Pin
biop.codeproject27-Aug-12 20:36
biop.codeproject27-Aug-12 20:36 
AnswerRe: AddHandler and RemoveHandler Pin
Simon_Whale27-Aug-12 22:50
Simon_Whale27-Aug-12 22:50 
GeneralRe: AddHandler and RemoveHandler Pin
biop.codeproject28-Aug-12 16:10
biop.codeproject28-Aug-12 16:10 
AnswerRe: AddHandler and RemoveHandler Pin
Shameel28-Aug-12 15:06
professionalShameel28-Aug-12 15:06 
QuestionControlling No. of Loggeed users Pin
SPSandy26-Aug-12 22:49
SPSandy26-Aug-12 22:49 
AnswerRe: Controlling No. of Loggeed users Pin
Eddy Vluggen27-Aug-12 0:12
professionalEddy Vluggen27-Aug-12 0:12 
GeneralRe: Controlling No. of Loggeed users Pin
SPSandy27-Aug-12 6:42
SPSandy27-Aug-12 6:42 
GeneralRe: Controlling No. of Loggeed users Pin
Eddy Vluggen27-Aug-12 8:01
professionalEddy Vluggen27-Aug-12 8:01 
GeneralRe: Controlling No. of Loggeed users Pin
SPSandy28-Aug-12 6:48
SPSandy28-Aug-12 6:48 
GeneralRe: Controlling No. of Loggeed users Pin
Eddy Vluggen28-Aug-12 8:05
professionalEddy Vluggen28-Aug-12 8:05 
AnswerRe: Controlling No. of Loggeed users Pin
pramod.hegde27-Aug-12 3:28
professionalpramod.hegde27-Aug-12 3:28 
You need to handle it in Global.asax file. If you observe, this class inherits HttpApplication which has a property HttpApplicationState. So you can set a variable LoggedInUsers in ApplicationSate when the application starts (Application_Start method) and you can keep updating the variable in Session_Start & Session_End methods.

C#
void Application_Start(object sender, EventArgs e)
{
    // Code that runs on application startup
    Application["LoggedInUsers"] = 0;
}
void Session_Start(object sender, EventArgs e)
{
    // Code that runs when a new session is started
    Application.Lock();
    Application["LoggedInUsers"] = (int)Application["LoggedInUsers"] + 1;
    Application.UnLock();
}

void Session_End(object sender, EventArgs e)
{
    // Code that runs when a session ends. 
    // Note: The Session_End event is raised only when the sessionstate mode
    // is set to InProc in the Web.config file. If session mode is set to StateServer 
    // or SQLServer, the event is not raised.
    Application.Lock();
    Application["LoggedInUsers"] = (int)Application["LoggedInUsers"] - 1;
    Application.UnLock();
}

GeneralRe: Controlling No. of Loggeed users Pin
SPSandy27-Aug-12 6:46
SPSandy27-Aug-12 6:46 
GeneralRe: Controlling No. of Loggeed users Pin
pramod.hegde27-Aug-12 6:52
professionalpramod.hegde27-Aug-12 6:52 
GeneralRe: Controlling No. of Loggeed users Pin
SPSandy28-Aug-12 6:49
SPSandy28-Aug-12 6:49 

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.