hi guys! help please. I have 2 windows form, form1 and login form, and in form1 there is a button which when i click it the login form will appear, but right after the code that call login form there is a code that i want to be executed if only the login form is closed is this posible? What im trying to do here is to get Default Network Credential by usingif the user choose to use Defualt Network Credential or Show a Login dialog box which will ask for a Username,Password and domain if the user choose not to use the Default Network Credential and excecute the next line of code after the code which calls the login form. Please see the code below to give you more idea.Any help please. Thanks in advance!Code:System.Net.CredentialCache.DefaultCredentials;
Code:public void chk_Credential_Settings() { if (chkSettingsUsedefault.Checked) { //Use default network credential. Should be logged on to domain. listService.Credentials = System.Net.CredentialCache.DefaultCredentials; listService.PreAuthenticate = true; } else { if (DomainUserName != null && DomainPswrd != null && DomainName != null) { //MessageBox.Show("DEFINED"); //Call the LogIn Form //execute the code below only when the LogIn form is close //The DomainUserName, DomainPswrd, DomainName is the //returned value when the form is closed. listService.Credentials = new NetworkCredential(DomainUserName, DomainPswrd, DomainName); listService.PreAuthenticate = true; } else { } } }




Reply With Quote