Click here to Skip to main content
15,886,919 members
Home / Discussions / C#
   

C#

 
GeneralRe: TCP chat Pin
priyajeni5-Sep-08 20:18
priyajeni5-Sep-08 20:18 
GeneralRe: TCP chat Pin
priyajeni6-Sep-08 0:43
priyajeni6-Sep-08 0:43 
GeneralRe: TCP chat Pin
#realJSOP6-Sep-08 2:09
mve#realJSOP6-Sep-08 2:09 
GeneralRe: TCP chat Pin
PIEBALDconsult6-Sep-08 4:10
mvePIEBALDconsult6-Sep-08 4:10 
AnswerRe: TCP chat Pin
Mbah Dhaim6-Sep-08 8:08
Mbah Dhaim6-Sep-08 8:08 
AnswerRe: TCP chat Pin
nelsonpaixao7-Sep-08 13:14
nelsonpaixao7-Sep-08 13:14 
GeneralRe: TCP chat Pin
priyajeni7-Sep-08 18:33
priyajeni7-Sep-08 18:33 
Questionlogin dialog help Pin
captjack5-Sep-08 16:43
captjack5-Sep-08 16:43 
background: just getting into C# and have some pretty basic questions. Using "MS Visual C# 2008 Express Edition" as the learning tool.

I have a simple project that consists of a main form that displays a grid with some data - and it works as expected. I am trying to add a login form which prompts for a user and password. The program.cs main looks like this:
static void Main()<br />
{<br />
    Application.EnableVisualStyles();<br />
    Application.SetCompatibleTextRenderingDefault(false);<br />
    Application.Run(new MainForm());<br />
}<br />

I added the login form to this code so that it would run before the main form was displayed. I modified the code as follows:
        static void Main()<br />
        {<br />
            Application.EnableVisualStyles();<br />
            Application.SetCompatibleTextRenderingDefault(false);<br />
<br />
            Application.Run(new loginForm());<br />
<br />
            if (loginForm.exitStatus != "Cancel")<br />
            {<br />
                Application.Run(new MainForm());<br />
            }<br />
        }


The login form (loginForm) has two buttons: Logon and Cancel. If Cancel is hit, I set a static variable in the form (exitStatus) to "Cancel". I then check the value when I return. If the value is not "Cancel" I call up the MainForm.

When I debug the code, the login form appears and when I select the Logon button to exit it does call the Application.Run(new MainForm()); code. However, nothing appears on the screen and the program exits.

Is this a proper way to use a login form or is there a better way? I would like the login to be the first form that appears.

Thanks for any assistance!
Wink | ;)




AnswerRe: login dialog help Pin
Ravi Kumar Tyagi5-Sep-08 18:39
Ravi Kumar Tyagi5-Sep-08 18:39 
AnswerRe: login dialog help Pin
zafersavas5-Sep-08 18:51
zafersavas5-Sep-08 18:51 
GeneralRe: login dialog help Pin
captjack6-Sep-08 4:12
captjack6-Sep-08 4:12 
GeneralRe: login dialog help Pin
zafersavas6-Sep-08 4:21
zafersavas6-Sep-08 4:21 
QuestionMobile Pin
nelsonpaixao5-Sep-08 13:55
nelsonpaixao5-Sep-08 13:55 
AnswerRe: Mobile Pin
Blue_Boy5-Sep-08 19:41
Blue_Boy5-Sep-08 19:41 
AnswerRe: Mobile Pin
CaptainKrtek7-Sep-08 8:55
CaptainKrtek7-Sep-08 8:55 
QuestionRight click GridView Pin
Jacob Dixon5-Sep-08 10:34
Jacob Dixon5-Sep-08 10:34 
AnswerRe: Right click GridView Pin
Bassam Saoud5-Sep-08 11:29
Bassam Saoud5-Sep-08 11:29 
GeneralRe: Right click GridView Pin
Jacob Dixon5-Sep-08 14:03
Jacob Dixon5-Sep-08 14:03 
AnswerRe: Right click GridView Pin
Mycroft Holmes5-Sep-08 13:47
professionalMycroft Holmes5-Sep-08 13:47 
GeneralRe: Right click GridView Pin
Jacob Dixon5-Sep-08 14:02
Jacob Dixon5-Sep-08 14:02 
Questionchange statusBar to Vista;s system tray style Pin
Jassim Rahma5-Sep-08 9:16
Jassim Rahma5-Sep-08 9:16 
QuestionFacade design pattern examples Pin
Member 39190495-Sep-08 8:52
Member 39190495-Sep-08 8:52 
AnswerRe: Facade design pattern examples Pin
MidwestLimey5-Sep-08 11:11
professionalMidwestLimey5-Sep-08 11:11 
GeneralRe: Facade design pattern examples Pin
Member 39190496-Sep-08 5:53
Member 39190496-Sep-08 5:53 
QuestionThe preferred way to return a DataSet in ADO.NET 2.0 Pin
Member 39190495-Sep-08 8:20
Member 39190495-Sep-08 8:20 

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.