private void btnlogout_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Are you sure you want to log out?", "Log Out - Student Management Sytem", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK)
            {
                this.Hide();
                logout = true;

                FormLogin lgn = new FormLogin();
                lgn.ShowDialog();
            }
        }
        private void Bw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            this.Hide();
            if (LicenseValid())
            {
                if (CheckTrail())
                {
                    if (!(TrailDaysRemaining() < 0))
                    {
                        this.Hide();

                        TrailForm trailForm = new TrailForm();
                        System.Media.SystemSounds.Asterisk.Play();
                        trailForm.Show();
                    }
                }
                else
                {
                    if (!(LicenseDaysRemaining() <= 0))
                    {
                        if (LicenseDaysRemaining() <= 3)
                        {
                            formLogin = new FormLogin();
                            formLogin.Show();
                            MessageBox.Show("Dear User, you have only " + LicenseDaysRemaining().ToString() + " Left. Upgrade it new Package!", "License Information", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        }
                        else
                        {
                            formLogin = new FormLogin();
                            formLogin.Show();
                        }
                    }
                    else
                    {
                        DialogResult result = MessageBox.Show("Your License is expired! Do you want to Activate it now?", "Product Expired - Student Management System", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk);
                        if (result == DialogResult.Yes)
                        {
                            GETID = 0;
                            Activation act = new Activation();

                            act.Show();
                        }
                        else
                        {
                            Application.Exit();
                        }
                    }
                }
            }
        }
        private void btnlogout_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Are you sure you want to log out?", "Log Out - Student Management Sytem", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) == DialogResult.OK)
            {
                this.Hide();
                logout = true;
                var configFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
                var settings   = configFile.AppSettings.Settings;

                /*/ if (settings.Count == 0 | settings[key] == null)
                 * {
                 *  settings.Add(key, value);
                 * }
                 * else
                 * {/*/
                settings["LastLogin"].Value = DateTime.Now.AddMinutes(-30).ToString();

                configFile.Save(ConfigurationSaveMode.Modified);
                ConfigurationManager.RefreshSection(configFile.AppSettings.SectionInformation.Name);
                FormLogin lgn = new FormLogin();
                lgn.ShowDialog();
            }
        }
 private void Bw_DoWork(object sender, DoWorkEventArgs e)
 {
     formLogin = new FormLogin();
 }