开发者

Windows form app : How to setup form orders?

开发者 https://www.devze.com 2023-02-02 05:58 出处:网络
HI, I\'m new to Windows form app and trying to build one prototype app. I\'ve designed a data entry form and coded the business logic. Now, I\'m trying to open the data entry form from my welcome for

HI,

I'm new to Windows form app and trying to build one prototype app. I've designed a data entry form and coded the business logic. Now, I'm trying to open the data entry form from my welcome form. But every time I run "Welcome" form, my data entry form runs ( it's created before welcome form ) . Where can I set the for开发者_C百科m's order of execution ?

Here is the form1 code,

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!!");

    }

}

}


In your solution you have a file called Program.cs, open it and change the following line:

 Application.Run(new Form1());

to

 Application.Run(new WelcomeForm());

where WelcomeForm is the name of your welcome UI class. This change will make you welcome form to show up when you start the application, after that you can add some code to start the other form when you want.

0

精彩评论

暂无评论...
验证码 换一张
取 消