コード例 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            //调用c程序:统计功能5
            Process myProcess = new Process();

            string fileName = @"c课设c语言部分.exe";

            ProcessStartInfo myProcessStartInfo = new ProcessStartInfo(fileName, "15");

            myProcess.StartInfo = myProcessStartInfo;

            myProcess.Start();

            while (!myProcess.HasExited)

            {
                myProcess.WaitForExit();
            }

            int returnValue = myProcess.ExitCode;
            //新建一个窗口,并在窗口打开c程序写好的过的结果文件
            Form17 cxjg = new Form17();

            cxjg.Show();
        }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != "" && textBox2.Text != "" && textBox3.Text != "")
            {
                //将输入的信息写入“函数参数.txt”
                StreamWriter sw = new StreamWriter("函数参数.txt", false, System.Text.Encoding.GetEncoding("GB2312"));
                sw.Write(textBox1.Text + "\r\n");
                sw.Write(textBox2.Text + "\r\n");
                sw.Write(textBox3.Text);
                sw.Dispose();
                this.textBox1.Text = "";
                //调用c程序:客人租房信息查询(按姓名,入住时间)
                Process myProcess = new Process();

                string fileName = @"c课设c语言部分.exe";

                ProcessStartInfo myProcessStartInfo = new ProcessStartInfo(fileName, "10");

                myProcess.StartInfo = myProcessStartInfo;

                myProcess.Start();

                while (!myProcess.HasExited)

                {
                    myProcess.WaitForExit();
                }

                int returnValue = myProcess.ExitCode;
                //新建一个窗口,并在窗口打开c程序写好的过的结果文件
                Form17 cxjg = new Form17();
                cxjg.Show();
            }
            else
            {
                MessageBox.Show("请正确输入参数", "参数错误");
            }
        }