📄 form1.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace csharp_win_subreport_logon
{
/// <summary>
/// Summary description for Form1
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
internal System.Windows.Forms.Label Label5;
internal System.Windows.Forms.GroupBox GroupBox1;
internal System.Windows.Forms.Label Label4;
internal System.Windows.Forms.Label Label3;
internal System.Windows.Forms.Label Label2;
internal System.Windows.Forms.Label Label1;
internal System.Windows.Forms.TextBox TextBox4;
internal System.Windows.Forms.TextBox TextBox3;
internal System.Windows.Forms.TextBox TextBox2;
internal System.Windows.Forms.TextBox TextBox1;
internal System.Windows.Forms.Button Button1;
internal System.Windows.Forms.Button Button2;
internal System.Windows.Forms.Label lblNote;
/// <summary>
/// Required designer variable
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.Label5 = new System.Windows.Forms.Label();
this.GroupBox1 = new System.Windows.Forms.GroupBox();
this.Label4 = new System.Windows.Forms.Label();
this.Label3 = new System.Windows.Forms.Label();
this.Label2 = new System.Windows.Forms.Label();
this.Label1 = new System.Windows.Forms.Label();
this.TextBox4 = new System.Windows.Forms.TextBox();
this.TextBox3 = new System.Windows.Forms.TextBox();
this.TextBox2 = new System.Windows.Forms.TextBox();
this.TextBox1 = new System.Windows.Forms.TextBox();
this.Button1 = new System.Windows.Forms.Button();
this.Button2 = new System.Windows.Forms.Button();
this.lblNote = new System.Windows.Forms.Label();
this.GroupBox1.SuspendLayout();
this.SuspendLayout();
//
// Label5
//
this.Label5.Font = new System.Drawing.Font("Times New Roman", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.Label5.Location = new System.Drawing.Point(80, 16);
this.Label5.Name = "Label5";
this.Label5.Size = new System.Drawing.Size(232, 32);
this.Label5.TabIndex = 12;
this.Label5.Text = "Pass Log on Information to a Subreport";
this.Label5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// GroupBox1
//
this.GroupBox1.Controls.AddRange(new System.Windows.Forms.Control[] {
this.Label4,
this.Label3,
this.Label2,
this.Label1,
this.TextBox4,
this.TextBox3,
this.TextBox2,
this.TextBox1});
this.GroupBox1.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.GroupBox1.Location = new System.Drawing.Point(40, 72);
this.GroupBox1.Name = "GroupBox1";
this.GroupBox1.Size = new System.Drawing.Size(296, 200);
this.GroupBox1.TabIndex = 13;
this.GroupBox1.TabStop = false;
this.GroupBox1.Text = "This Log on information will be used for both the main report and the subreport";
//
// Label4
//
this.Label4.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.Label4.Location = new System.Drawing.Point(12, 160);
this.Label4.Name = "Label4";
this.Label4.Size = new System.Drawing.Size(108, 24);
this.Label4.TabIndex = 15;
this.Label4.Text = "Database Name";
//
// Label3
//
this.Label3.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.Label3.Location = new System.Drawing.Point(12, 120);
this.Label3.Name = "Label3";
this.Label3.Size = new System.Drawing.Size(108, 24);
this.Label3.TabIndex = 14;
this.Label3.Text = "Password";
//
// Label2
//
this.Label2.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.Label2.Location = new System.Drawing.Point(12, 80);
this.Label2.Name = "Label2";
this.Label2.Size = new System.Drawing.Size(108, 24);
this.Label2.TabIndex = 13;
this.Label2.Text = "User ID";
//
// Label1
//
this.Label1.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.Label1.Location = new System.Drawing.Point(8, 40);
this.Label1.Name = "Label1";
this.Label1.Size = new System.Drawing.Size(104, 24);
this.Label1.TabIndex = 12;
this.Label1.Text = "Server Name";
//
// TextBox4
//
this.TextBox4.Location = new System.Drawing.Point(144, 160);
this.TextBox4.Name = "TextBox4";
this.TextBox4.Size = new System.Drawing.Size(136, 20);
this.TextBox4.TabIndex = 11;
this.TextBox4.Text = "";
//
// TextBox3
//
this.TextBox3.Location = new System.Drawing.Point(144, 120);
this.TextBox3.Name = "TextBox3";
this.TextBox3.PasswordChar = '*';
this.TextBox3.Size = new System.Drawing.Size(136, 20);
this.TextBox3.TabIndex = 10;
this.TextBox3.Text = "";
//
// TextBox2
//
this.TextBox2.Location = new System.Drawing.Point(144, 80);
this.TextBox2.Name = "TextBox2";
this.TextBox2.Size = new System.Drawing.Size(136, 20);
this.TextBox2.TabIndex = 9;
this.TextBox2.Text = "";
//
// TextBox1
//
this.TextBox1.Location = new System.Drawing.Point(144, 40);
this.TextBox1.Name = "TextBox1";
this.TextBox1.Size = new System.Drawing.Size(136, 20);
this.TextBox1.TabIndex = 8;
this.TextBox1.Text = "";
//
// Button1
//
this.Button1.Location = new System.Drawing.Point(56, 288);
this.Button1.Name = "Button1";
this.Button1.Size = new System.Drawing.Size(96, 23);
this.Button1.TabIndex = 14;
this.Button1.Text = "Launch Report";
this.Button1.Click += new System.EventHandler(this.Button1_Click);
//
// Button2
//
this.Button2.Location = new System.Drawing.Point(216, 288);
this.Button2.Name = "Button2";
this.Button2.Size = new System.Drawing.Size(96, 23);
this.Button2.TabIndex = 15;
this.Button2.Text = "Exit";
this.Button2.Click += new System.EventHandler(this.Button2_Click);
//
// lblNote
//
this.lblNote.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.lblNote.Location = new System.Drawing.Point(24, 336);
this.lblNote.Name = "lblNote";
this.lblNote.Size = new System.Drawing.Size(328, 56);
this.lblNote.TabIndex = 16;
this.lblNote.Text = "Note: This report connects via the OLE DB Provider to the Northwind database tha" +
"t SQL Server installs by default. Enter \'Northwind\' for the Database parameter." +
"";
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(376, 429);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.lblNote,
this.Button2,
this.Button1,
this.GroupBox1,
this.Label5});
this.Name = "Form1";
this.Text = "Login Form";
this.GroupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void Button1_Click(object sender, System.EventArgs e)
{
Form2 rptForm =new Form2(TextBox1.Text, TextBox2.Text, TextBox3.Text, TextBox4.Text);
rptForm.Show();
}
private void Button2_Click(object sender, System.EventArgs e)
{
this.Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -