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

C#

 
AnswerRe: LoadPostData Error Pin
Gareth H5-May-08 6:21
Gareth H5-May-08 6:21 
GeneralRe: LoadPostData Error Pin
ceetee5-May-08 7:12
ceetee5-May-08 7:12 
Questiondisable taskmanager Pin
False Chicken5-May-08 5:03
False Chicken5-May-08 5:03 
AnswerRe: disable taskmanager Pin
tgrt5-May-08 5:42
tgrt5-May-08 5:42 
AnswerRe: disable taskmanager Pin
Dave Kreskowiak5-May-08 6:48
mveDave Kreskowiak5-May-08 6:48 
AnswerRe: disable taskmanager Pin
Giorgi Dalakishvili5-May-08 8:07
mentorGiorgi Dalakishvili5-May-08 8:07 
AnswerRe: disable taskmanager Pin
PIEBALDconsult5-May-08 8:44
mvePIEBALDconsult5-May-08 8:44 
QuestionAdd login form to a program? Pin
daden2035-May-08 4:48
daden2035-May-08 4:48 
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.
Currently I still don't use the login Form, and now I want to add it to the program rather than using it by default. Below is the code of the Program.cs. How can I add a form ( in this form I have 4 text box for host/port/loginame/pwd and two button Connect and Exit) to the main Form but still do not change the overall structure of the program?

Here is the program.cs

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);
try
{
manager.Login(); // Login only (fast)
}
catch (Exception ex)
{
Console.WriteLine(ex);
Console.ReadLine();
manager.Logoff();
return;
}
// a lot of code here
}
#end region
}
}


I still don't know how to write the Connect button event clicked: private void btnServerConnect_Click(object sender, EventArgs e). Maybe I still have some difficulties in understanding the structure of the login, the relation with the login form, main form and the file program.cs. How to organize it in an appropriately manner?

Please help me!
Thank you very much!
AnswerRe: Add login form to a program? Pin
carbon_golem5-May-08 6:51
carbon_golem5-May-08 6:51 
Questionhow I know that which property is associated which file at run time. Pin
Guru Call5-May-08 4:47
Guru Call5-May-08 4:47 
QuestionRunning a form in a diferent Thread Pin
oscarderooij5-May-08 4:07
oscarderooij5-May-08 4:07 
AnswerRe: Running a form in a diferent Thread Pin
S. Senthil Kumar5-May-08 5:34
S. Senthil Kumar5-May-08 5:34 
GeneralRe: Running a form in a diferent Thread Pin
oscarderooij6-May-08 2:29
oscarderooij6-May-08 2:29 
GeneralRe: Running a form in a diferent Thread Pin
S. Senthil Kumar6-May-08 2:54
S. Senthil Kumar6-May-08 2:54 
GeneralRe: Running a form in a diferent Thread Pin
oscarderooij13-May-08 3:27
oscarderooij13-May-08 3:27 
AnswerRe: Running a form in a diferent Thread Pin
Luc Pattyn5-May-08 7:19
sitebuilderLuc Pattyn5-May-08 7:19 
GeneralRe: Running a form in a diferent Thread Pin
oscarderooij6-May-08 2:42
oscarderooij6-May-08 2:42 
GeneralRe: Running a form in a diferent Thread Pin
Luc Pattyn6-May-08 4:21
sitebuilderLuc Pattyn6-May-08 4:21 
GeneralRe: Running a form in a diferent Thread Pin
oscarderooij13-May-08 3:25
oscarderooij13-May-08 3:25 
GeneralRe: Running a form in a diferent Thread Pin
Luc Pattyn13-May-08 3:45
sitebuilderLuc Pattyn13-May-08 3:45 
GeneralRe: Running a form in a diferent Thread Pin
oscarderooij13-May-08 3:28
oscarderooij13-May-08 3:28 
GeneralRe: Running a form in a diferent Thread Pin
Luc Pattyn13-May-08 3:40
sitebuilderLuc Pattyn13-May-08 3:40 
GeneralRe: Running a form in a diferent Thread Pin
oscarderooij15-May-08 7:45
oscarderooij15-May-08 7:45 
QuestionForeach property in myClass Pin
Harvey Saayman5-May-08 3:57
Harvey Saayman5-May-08 3:57 
AnswerRe: Foreach property in myClass Pin
Colin Angus Mackay5-May-08 4:04
Colin Angus Mackay5-May-08 4:04 

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.