Click here to Skip to main content
15,887,214 members
Home / Discussions / C#
   

C#

 
GeneralRe: Threading question Pin
kensai5-May-08 21:28
kensai5-May-08 21:28 
Questionrunning script using Sqlcmd Pin
Denver Thomas5-May-08 3:45
Denver Thomas5-May-08 3:45 
QuestionInvalid Cast Problem using Enterprise Library MS DAAB (with dynamic dll loading) Pin
Pankaj Chamria5-May-08 3:21
Pankaj Chamria5-May-08 3:21 
QuestionAdding Active Directory Users to local Groups Pin
André Stroebel5-May-08 3:05
André Stroebel5-May-08 3:05 
AnswerRe: Adding Active Directory Users to local Groups Pin
André Stroebel5-May-08 3:26
André Stroebel5-May-08 3:26 
QuestionDataGridView Selection Pin
stancrm5-May-08 3:03
stancrm5-May-08 3:03 
AnswerRe: DataGridView Selection Pin
Csharp™5-May-08 10:46
Csharp™5-May-08 10:46 
QuestionHow to global access from other forms? Pin
daden2035-May-08 2:53
daden2035-May-08 2:53 
I need to write a manager program connect to a remote server to display the status of the server. I have a login form, when i connect successful it will show the main form. In this form I have a lot of buttons (on the left panel), each button when we click will open a new form (on the right panel).

I want to declare and initialize all the variable at the beginning of the program, in Program.cs file and using the varialbes and methods in other forms. See the code Snippet below.
My question is that, when I initialize an instance of AManager in region checkManagerAPI() like above:
_manager = new AManager(host, port, loginame, loginpwd);
When I change to another form, why I can't use the _manager again? How to make it become global access?

using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace MainForm
{
static class Program
{
const string host = "10.0.0.2";
const int port = 5000;
const string loginame = "name";
const string loginpwd = "pwd";
.....

public static AManager manager;
///
/// The main entry point for the application.
///

[STAThread]
static void Main()
{

Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
checkManagerAPI();
Application.Run(new FrmMain());
}
// checkManagerAPI() region is here:
#region checkManagerAPI()
checkManagerAPI();
{
manager = new AsteriskManager(host, port, loginame, loginpwd);
//a lot of code....
}
#end region
}
}
AnswerRe: How to global access from other forms? Pin
Christian Graus5-May-08 2:54
protectorChristian Graus5-May-08 2:54 
GeneralRe: How to global access from other forms? Pin
daden2035-May-08 3:16
daden2035-May-08 3:16 
Questionwhat happens if value is longer than fieldlength Pin
stephan_0075-May-08 2:45
stephan_0075-May-08 2:45 
AnswerRe: what happens if value is longer than fieldlength Pin
Christian Graus5-May-08 2:55
protectorChristian Graus5-May-08 2:55 
AnswerRe: what happens if value is longer than fieldlength Pin
Gareth H5-May-08 2:55
Gareth H5-May-08 2:55 
GeneralRe: what happens if value is longer than fieldlength Pin
stephan_0075-May-08 3:00
stephan_0075-May-08 3:00 
GeneralRe: what happens if value is longer than fieldlength [modified] Pin
stephan_0075-May-08 3:03
stephan_0075-May-08 3:03 
AnswerRe: what happens if value is longer than fieldlength Pin
SomeGuyThatIsMe5-May-08 2:57
SomeGuyThatIsMe5-May-08 2:57 
GeneralRe: what happens if value is longer than fieldlength Pin
stephan_0075-May-08 3:16
stephan_0075-May-08 3:16 
GeneralRe: what happens if value is longer than fieldlength Pin
SomeGuyThatIsMe5-May-08 3:31
SomeGuyThatIsMe5-May-08 3:31 
QuestionUsing "DictationGrammar" to dictate a URL Pin
thoraia5-May-08 2:37
thoraia5-May-08 2:37 
QuestionDynamic workflow Project Pin
Thaer Hamael5-May-08 2:00
Thaer Hamael5-May-08 2:00 
AnswerCP Members: question already asked Pin
leckey5-May-08 17:40
leckey5-May-08 17:40 
QuestionLayout takes time to rearrange after rezise, how to fix? Pin
leeoze5-May-08 1:59
leeoze5-May-08 1:59 
AnswerRe: Layout takes time to rearrange after rezise, how to fix? Pin
Anthony Mushrow5-May-08 2:13
professionalAnthony Mushrow5-May-08 2:13 
QuestionHyperlinks to access outlook items Pin
asasov5-May-08 1:49
asasov5-May-08 1:49 
AnswerRe: Hyperlinks to access outlook items Pin
Anthony Mushrow5-May-08 2:19
professionalAnthony Mushrow5-May-08 2:19 

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.