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

C#

 
AnswerRe: DataGridView null row Pin
Ennis Ray Lynch, Jr.5-May-08 10:32
Ennis Ray Lynch, Jr.5-May-08 10:32 
GeneralRe: DataGridView null row Pin
tjschilling5-May-08 11:24
tjschilling5-May-08 11:24 
QuestionHow to refresh a comboBox that is bind to a table from a SqlDataBase? Pin
ioanap_855-May-08 8:59
ioanap_855-May-08 8:59 
AnswerRe: How to refresh a comboBox that is bind to a table from a SqlDataBase? Pin
SomeGuyThatIsMe5-May-08 9:34
SomeGuyThatIsMe5-May-08 9:34 
AnswerRe: How to refresh a comboBox that is bind to a table from a SqlDataBase? Pin
Dave Kreskowiak5-May-08 9:34
mveDave Kreskowiak5-May-08 9:34 
QuestionUse a maked textbox to limit entry to some char Pin
baranils5-May-08 8:56
baranils5-May-08 8:56 
AnswerRe: Use a maked textbox to limit entry to some char Pin
#realJSOP5-May-08 9:51
professional#realJSOP5-May-08 9:51 
GeneralRe: Use a maked textbox to limit entry to some char Pin
baranils5-May-08 10:07
baranils5-May-08 10:07 
GeneralRe: Use a maked textbox to limit entry to some char Pin
#realJSOP5-May-08 11:03
professional#realJSOP5-May-08 11:03 
GeneralRe: Use a maked textbox to limit entry to some char Pin
baranils5-May-08 19:14
baranils5-May-08 19:14 
AnswerRe: Use a maked textbox to limit entry to some char Pin
Christian Graus5-May-08 18:08
protectorChristian Graus5-May-08 18:08 
GeneralRe: Use a maked textbox to limit entry to some char Pin
#realJSOP6-May-08 3:30
professional#realJSOP6-May-08 3:30 
QuestionHow to traverse class properties for Nunit tests? Pin
pankazmittal5-May-08 6:47
pankazmittal5-May-08 6:47 
AnswerRe: How to traverse class properties for Nunit tests? Pin
Gareth H5-May-08 7:36
Gareth H5-May-08 7:36 
AnswerRe: How to traverse class properties for Nunit tests? Pin
Brady Kelly5-May-08 8:37
Brady Kelly5-May-08 8:37 
AnswerRe: How to traverse class properties for Nunit tests? Pin
Ed.Poore5-May-08 12:02
Ed.Poore5-May-08 12:02 
QuestionLoadPostData Error Pin
ceetee5-May-08 5:53
ceetee5-May-08 5:53 
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!

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.