标题:×号问题?
取消只看楼主
serveryh
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2010-11-20
结帖率:100%
已结贴  问题点数:20 回复次数:7 
×号问题?
form中点×号,程序没有结束为什么啊?
想要它结束怎么办啊?
搜索更多相关主题的帖子: 怎么办 
2010-11-30 10:49
serveryh
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2010-11-20
得分:0 
回复 楼主 serveryh
不行
2010-11-30 10:56
serveryh
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2010-11-20
得分:0 
回复 2楼 zhoufeng1988
我想在程序中让它结束
2010-11-30 10:57
serveryh
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2010-11-20
得分:0 
点击×号是不是执行它
  private void Form2_Closing(object sender, e)
        {
            //System.Environment.Exit(0);
            form2.close();

        }
2010-11-30 10:58
serveryh
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2010-11-20
得分:0 
回复 7楼 xieliu0048
protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

没有啊!
2010-11-30 11:15
serveryh
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2010-11-20
得分:0 
回复 9楼 c1_wangyf
private void Form2_Closing(object sender, e)
        {
            //System.Environment.Exit(0);
            Application.Exit();

        }
这样也不行!
2010-11-30 13:13
serveryh
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2010-11-20
得分:0 
using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace FirstFace
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        private void Form2_Closing(object sender, e)
        {
            //System.Environment.Exit(0);
            Application.Exit();

        }

        private void Form2_Load(object sender, EventArgs e)
        {
           
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Form4 form4 = new Form4();
             form4.Show();
        }

        private void button2_Click(object sender, EventArgs e)
        {
           
            if (Form1.type.Equals("总经理") || Form1.type.Equals("部门经理"))      //权限控制
            {
                Form5 form5 = new Form5();
                form5.Show();

               SqlConnection con = new SqlConnection("server=.\\sqlexpress;Integrated Security=SSPI;DataBase=MyDB");
                con.Open();
               SqlCommand cmd = new SqlCommand("select  DeclarerID   from  Declaration where flow=0", con);    //查找状态为等待审批的DeclarerID
               SqlDataReader reader = cmd.ExecuteReader();
                 while (reader.Read())
                {
                   (reader[0].ToString());
                 }
            }

            else
            {
                MessageBox.Show("对不起你没有权限访问!");
            }
           
        
        }

        private void button3_Click(object sender, EventArgs e)
        {
            if (Form1.type.Equals("出纳员") || Form1.type.Equals("总经理") || Form1.type.Equals("部门经理"))      //权限控制
            {
                Form6 form6 = new Form6();
                form6.Show();

                SqlConnection con = new SqlConnection("server=.\\sqlexpress;Integrated Security=SSPI;DataBase=MyDB");
                con.Open();
                SqlCommand cmd = new SqlCommand("select  DeclarerID   from  Declaration where flow=1", con);
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    (reader[0].ToString());
                }
            }

            else
            {
                MessageBox.Show("对不起你没有权限访问!");
            }
        }

        private void button4_Click(object sender, EventArgs e)
        {
            if (Form1.type.Equals("会计员") || Form1.type.Equals("总经理") || Form1.type.Equals("部门经理"))      //权限控制
            {
                Form7 form7 = new Form7();
                form7.Show();

                SqlConnection con = new SqlConnection("server=.\\sqlexpress;Integrated Security=SSPI;DataBase=MyDB");
                con.Open();
                SqlCommand cmd = new SqlCommand("select  DeclarerID   from  Declaration where flow=2", con);
                SqlDataReader reader = cmd.ExecuteReader();
                while (reader.Read())
                {
                    (reader[0].ToString());
                }
            }

            else
            {
                MessageBox.Show("对不起你没有权限访问!");
            }
        }

        private void 密码修改ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Form8 form8 = new Form8();
            form8.Show();
        }

        private void 系统注销ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("您确定要注销登录吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
           if (dr == DialogResult.Yes)   
            {   
                Application.ExitThread();   
                System.Diagnostics.Process.Start(System.Reflection.Assembly.GetExecutingAssembly().Location);      
  
            }
           else
           {
           }

        }

        private void 系统退出ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult dr = MessageBox.Show("您确定要退出登录吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (dr == DialogResult.Yes)
                System.Environment.Exit(0);
            else
            {
            }
        }

        private void 帮助ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MessageBox.Show("谢谢!","提示");
        }



   
    }
}
2010-11-30 14:07
serveryh
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2010-11-20
得分:0 
回复 14楼 xieliu0048
System.Environment.Exit(0);
           
 Application.Exit();

这两个都不行!
2010-11-30 14:52



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-327371-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.167043 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved