HI,
我是Windows表单应用程序的新手,并尝试构建一个原型应用程序。我设计了一个数据输入表单并编写了业务逻辑。现在,我正在尝试从我的欢迎表单中打开数据输入表单。但每次我运行“欢迎”表单时,我的数据输入表单都会运行(它是在欢迎表单之前创建的)。我在哪里可以设置表单的执行顺序?
这是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!!");
}
}
}
答案 0 :(得分:2)
在您的解决方案中,您有一个名为 Program.cs 的文件,打开它并更改以下行:
Application.Run(new Form1());
到
Application.Run(new WelcomeForm());
其中WelcomeForm是欢迎UI类的名称。此更改将使您在启动应用程序时显示欢迎表单,之后您可以添加一些代码以在需要时启动其他表单。