gridfindform.cs

来自「《C#和.NET第一步》中的财务系统 利用三层结构做的」· CS 代码 · 共 60 行

CS
60
字号
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace HomeMoney
{
	public partial class GridFindForm : Form
	{
		private FindType findType = FindType.FDateTime;
		private string findValue = string.Empty;

		public enum FindType { FDateTime, FName, FRemark }
		public FindType Type
		{
			get { return findType; }
		}
		public string FindValue
		{
			get { return findValue; }
		}

		public GridFindForm()
		{
			InitializeComponent();
		}
		private void btnOK_Click(object sender, EventArgs e)
		{
			switch (this.cbFindItem.SelectedItem.ToString())
			{
				case "交易日期": findType = FindType.FDateTime; break;
				case "项目名称": findType = FindType.FName; break;
				case "交易说明": findType = FindType.FRemark; break;
			}
			if (findType == FindType.FDateTime)
				this.findValue = this.dtValue.Value.ToShortDateString();
			else
				this.findValue = this.txtValue.Text;

			this.Close();
		}

		private void cbFindItem_SelectedIndexChanged(object sender, EventArgs e)
		{
			if (this.cbFindItem.SelectedItem.ToString() == "交易日期")
			{
				this.dtValue.Visible = true;
				this.txtValue.Visible = false;
			}
			else
			{
				this.dtValue.Visible = false;
				this.txtValue.Visible = true;
			}
		}
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?