嗨,
我是Windows窗体应用程序的新手,正在尝试构建一个原型应用程序。我设计了一个数据输入表单,并对业务逻辑进行了编码。现在,我正在尝试从我的欢迎表单中打开数据输入表单。但每次我运行" welcome“表单时,我的数据输入表单都会运行(它是在欢迎表单之前创建的)。我可以在哪里设置表单的执行顺序?
这是form1代码,
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using iTextSharp.text;
using iTextSharp.text.pdf;
using System.IO;
namespace PrototypeApp
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button3_Click(object sender, EventArgs e)
{
string pdfTemplate = "C:\\app\\End_Of_Project_Client_Evaluation_Template.pdf";
string newFile = "C:\\app\\End_Of_Project_Client_Evaluation_Template_update.pdf";
PdfReader reader = new PdfReader(pdfTemplate);
PdfStamper pdfStamper = new PdfStamper(reader, new FileStream(newFile, FileMode.Create));
AcroFields fields = pdfStamper.AcroFields;
fields.SetField("client", txtClient.Text);
fields.SetField("project", txtProject.Text);
fields.SetField("project_area", txtArea.Text);
fields.SetField("project_no", txtLandProjectNo.Text);
fields.SetField("suggestions", txtSuggestions.Text);
fields.SetField("project_strength", txtStrengths.Text);
fields.SetField("other_suggestions", txtComments.Text);
pdfStamper.FormFlattening = false;
// close the pdf
pdfStamper.Close();
MessageBox.Show("Pdf document successfully updated!!");
}
}}
发布于 2011-01-05 14:24:41
在您的解决方案中,有一个名为Program.cs的文件,打开它并更改以下行:
Application.Run(new Form1());至
Application.Run(new WelcomeForm());其中WelcomeForm是欢迎UI类的名称。此更改将使您欢迎窗体在您启动应用程序时显示,之后您可以添加一些代码以在需要时启动其他窗体。
https://stackoverflow.com/questions/4601223
复制相似问题