标题:×号问题?
只看楼主
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
wangnannan
Rank: 18Rank: 18Rank: 18Rank: 18Rank: 18
等 级:贵宾
威 望:87
帖 子:2545
专家分:9359
注 册:2007-11-3
得分:0 
LZ不是来这里无聊的吧 ? 要么你把代码贴出来吧

[ 本帖最后由 wangnannan 于 2010-11-30 13:32 编辑 ]

出来混,谁不都要拼命的嘛。 。拼不赢?那就看谁倒霉了。 。有机会也要看谁下手快,快的就能赢,慢。 。狗屎你都抢不到。 。还说什么拼命?
2010-11-30 13:28
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
xieliu0048
Rank: 2
等 级:论坛游民
帖 子:44
专家分:30
注 册:2010-11-30
得分:0 
是不是在执行过程中出现了hide()方法呢,那样要要用Application.Exit();
2010-11-30 14:44
serveryh
Rank: 1
等 级:新手上路
帖 子:27
专家分:0
注 册:2010-11-20
得分:0 
回复 14楼 xieliu0048
System.Environment.Exit(0);
           
 Application.Exit();

这两个都不行!
2010-11-30 14:52
xieliu0048
Rank: 2
等 级:论坛游民
帖 子:44
专家分:30
注 册:2010-11-30
得分:0 
程序没结束,当前窗体已关闭是吧,是不是出现类似Hide()之类的隐藏方法。
2010-12-01 09:41
xieliu0048
Rank: 2
等 级:论坛游民
帖 子:44
专家分:30
注 册:2010-11-30
得分:0 
哦  我错了  搞不懂了
2010-12-01 09:42
xieliu0048
Rank: 2
等 级:论坛游民
帖 子:44
专家分:30
注 册:2010-11-30
得分:0 
private void Form2_Closing(object sender, e)
        {
            //System.Environment.Exit(0);
            Application.Exit();

        }

你后面那个参数有点怪,你调试进来了这个方法没.....
2010-12-01 09:44



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




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

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