⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 materialsform.h

📁 Visual C++.net数据库开发经典案例
💻 H
📖 第 1 页 / 共 4 页
字号:
#pragma once
#include "LinkDataBase.h"
#include "DataGridNoActiveCellColumn.h"

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;


namespace My
{
	/// <summary> 
	/// MaterialsForm 摘要
	///
	/// 警告: 如果您更改该类的名称,则将需要更改 
	///          与该类所依赖的所有 .resx 文件关联的托管资源编译器工具的 
	///          “资源文件名”属性。  否则,
	///          设计器将不能与此窗体关联的
	///          本地化资源正确交互。
	/// </summary>
	public __gc class MaterialsForm : public System::Windows::Forms::Form
	{
		//--------------------成员声明------------------------
	private:
		LinkDataBase* MyDataBase;	//数据库连接类
		SqlDataAdapter* MaterialsAdpater;
		SqlDataAdapter* PlanTypeAdpater;
		DataSet* ds;
		String* strTableName;
		String* strSQL;
	private: System::Windows::Forms::TextBox *  tBoxMaterialName;
	private: System::Windows::Forms::ToolBarButton *  tBtnPreviousRecord;
	private: System::Windows::Forms::ToolBarButton *  tBtnNextRecord;
	private: System::Windows::Forms::ImageList *  imageList1;
			 CurrencyManager* cmOrders;
		//-------------------成员声明结束-----------------------
	public: 
		MaterialsForm(void)
		{
			InitializeComponent();
			//初始化
			this->MyDataBase = new LinkDataBase();
			this->ds = new DataSet();
			this->MaterialsAdpater = new SqlDataAdapter();
			this->PlanTypeAdpater = new SqlDataAdapter();			
			

			//查询物料主文件
			this->strSQL = S"Select * from 物料主文件";
			this->strTableName = S"物料主文件";
			this->MyDataBase->SelectDataBase(this->MaterialsAdpater,this->ds,this->strSQL,this->strTableName);
            
			//查询物料计划类别
			this->strSQL = S"Select 类别名称,类别代码 from 物料计划类别";
			this->strTableName = S"物料计划类别";
			this->MyDataBase->SelectDataBase(this->PlanTypeAdpater,this->ds,this->strSQL,this->strTableName);

			this->cmOrders = __try_cast<CurrencyManager*>(BindingContext->get_Item(ds,S"物料主文件"));
			//设置DataGrid
			this->dgrdMaterials->DataSource = this->ds->Tables->Item[S"物料主文件"];
			this->DataGridStateControl();
			

			//填充[计量单位]的选项
			String* tempSQL = S"Select distinct 计量单位 from 物料主文件";
			SqlDataReader* tempReader = this->MyDataBase->SQLRead(tempSQL);

			while(tempReader->Read())
			{
				this->cmbUnit->Items->Add(tempReader->GetValue(0)->ToString()->Trim());
			}
			tempReader->Close();
			//设置[计划类别]的数据和选项
			this->cmbPlanType->DataSource = this->ds->Tables->Item[S"物料计划类别"];
			this->cmbPlanType->DisplayMember = S"类别名称";
			this->cmbPlanType->ValueMember = S"类别代码";

			//设置控件的数据邦定
			this->SetDataBindings();
			//设置控件ReadOnly属性
			this->SetModify(false);
		}
        
	protected: 
		void Dispose(Boolean disposing)
		{
			if (disposing && components)
			{
				components->Dispose();
			}
			__super::Dispose(disposing);
		}
	private: System::Windows::Forms::ToolBar *  toolBar1;

	private: System::Windows::Forms::ToolBarButton *  tBtnFirstRecord;


	private: System::Windows::Forms::ToolBarButton *  tBtnLastRecord;
	private: System::Windows::Forms::ToolBarButton *  tBtnNewRecord;
	private: System::Windows::Forms::ToolBarButton *  tBtnModifyRecord;
	private: System::Windows::Forms::ToolBarButton *  tBtnDeleteRecord;
	private: System::Windows::Forms::ToolBarButton *  tBtnPostModified;
	private: System::Windows::Forms::ToolBarButton *  tBtnCancleModified;
	private: System::Windows::Forms::ToolBarButton *  tBtnQuit;
	private: System::Windows::Forms::GroupBox *  groupBox1;


	private: System::Windows::Forms::Button *  btnSearch;
	private: System::Windows::Forms::Label *  label1;
	private: System::Windows::Forms::TextBox *  tBoxMaterialID;

	private: System::Windows::Forms::Label *  label2;

	private: System::Windows::Forms::Label *  label4;


	private: System::Windows::Forms::TextBox *  tBoxMaterialWord;
	private: System::Windows::Forms::GroupBox *  groupBox2;
	private: System::Windows::Forms::TextBox *  tBoxMateriaNameDisplay;
	private: System::Windows::Forms::TextBox *  tBoxMaterialIDDisplay;
	private: System::Windows::Forms::Label *  label5;
	private: System::Windows::Forms::TextBox *  tBoxMaterialWordDisplay;
	private: System::Windows::Forms::Label *  label6;
	private: System::Windows::Forms::Label *  label7;

	private: System::Windows::Forms::Label *  label3;
	private: System::Windows::Forms::ComboBox *  cmbUnit;
	private: System::Windows::Forms::Label *  label8;



	private: System::Windows::Forms::Label *  label9;

	private: System::Windows::Forms::Label *  label10;
	private: System::Windows::Forms::Label *  label11;


	private: System::Windows::Forms::Label *  label12;




	private: System::Windows::Forms::Label *  label13;

	private: System::Windows::Forms::Label *  label14;
	private: System::Windows::Forms::Label *  label15;



	private: System::Windows::Forms::Label *  label16;
	private: System::Windows::Forms::Label *  label17;
	private: System::Windows::Forms::Label *  label18;
	private: System::Windows::Forms::Label *  label19;
	private: System::Windows::Forms::Label *  label21;




	private: System::Windows::Forms::Label *  label22;

	private: System::Windows::Forms::Label *  label23;
	private: System::Windows::Forms::Label *  label24;
	private: System::Windows::Forms::Label *  label20;
	private: System::Windows::Forms::Label *  label25;




	private: System::Windows::Forms::Label *  label26;

	private: System::Windows::Forms::Label *  label27;
	private: System::Windows::Forms::Label *  label28;
	private: System::Windows::Forms::ComboBox *  cmbPlanType;
	private: System::Windows::Forms::TextBox *  tBoxRecordDate;
	private: System::Windows::Forms::TextBox *  tBoxModel;
	private: System::Windows::Forms::TextBox *  tBoxRecorder;
	private: System::Windows::Forms::TextBox *  tBoxProperty2;
	private: System::Windows::Forms::TextBox *  tBoxProperty1;
	private: System::Windows::Forms::TextBox *  tBoxProperty3;
	private: System::Windows::Forms::TextBox *  tBoxProperty4;
private: System::Windows::Forms::TextBox *  tBoxWidth;
private: System::Windows::Forms::TextBox *  tBoxLong;
private: System::Windows::Forms::TextBox *  tBoxHeight;
private: System::Windows::Forms::TextBox *  tBoxBrand;
private: System::Windows::Forms::TextBox *  tBoxNetWeight;
private: System::Windows::Forms::TextBox *  tBoxColour;
private: System::Windows::Forms::TextBox *  tBoxMinimumPack;
private: System::Windows::Forms::TextBox *  tBoxProduceCycle;
private: System::Windows::Forms::TextBox *  tBoxImportAhead;
private: System::Windows::Forms::TextBox *  tBoxRank;
private: System::Windows::Forms::TextBox *  tBoxPrepareCycle;
private: System::Windows::Forms::TextBox *  tBoxMinimumDistribution;
private: System::Windows::Forms::TextBox *  tBoxStorageTerm;
private: System::Windows::Forms::TextBox *  tBoxMaximumStorage;
private: System::Windows::Forms::TextBox *  tBoxBatch;
private: System::Windows::Forms::TextBox *  tBoxMinimumStorage;
private: System::Windows::Forms::DataGrid *  dgrdMaterials;

	private: System::ComponentModel::IContainer *  components;

	private:
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>


		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		void InitializeComponent(void)
		{
			this->components = new System::ComponentModel::Container();
			System::Resources::ResourceManager *  resources = new System::Resources::ResourceManager(__typeof(My::MaterialsForm));
			this->toolBar1 = new System::Windows::Forms::ToolBar();
			this->tBtnFirstRecord = new System::Windows::Forms::ToolBarButton();
			this->tBtnPreviousRecord = new System::Windows::Forms::ToolBarButton();
			this->tBtnNextRecord = new System::Windows::Forms::ToolBarButton();
			this->tBtnLastRecord = new System::Windows::Forms::ToolBarButton();
			this->tBtnNewRecord = new System::Windows::Forms::ToolBarButton();
			this->tBtnModifyRecord = new System::Windows::Forms::ToolBarButton();
			this->tBtnDeleteRecord = new System::Windows::Forms::ToolBarButton();
			this->tBtnPostModified = new System::Windows::Forms::ToolBarButton();
			this->tBtnCancleModified = new System::Windows::Forms::ToolBarButton();
			this->tBtnQuit = new System::Windows::Forms::ToolBarButton();
			this->groupBox1 = new System::Windows::Forms::GroupBox();
			this->tBoxMaterialName = new System::Windows::Forms::TextBox();
			this->label2 = new System::Windows::Forms::Label();
			this->tBoxMaterialID = new System::Windows::Forms::TextBox();
			this->label1 = new System::Windows::Forms::Label();
			this->btnSearch = new System::Windows::Forms::Button();
			this->tBoxMaterialWord = new System::Windows::Forms::TextBox();
			this->label4 = new System::Windows::Forms::Label();
			this->dgrdMaterials = new System::Windows::Forms::DataGrid();
			this->groupBox2 = new System::Windows::Forms::GroupBox();
			this->label20 = new System::Windows::Forms::Label();
			this->label25 = new System::Windows::Forms::Label();
			this->tBoxMinimumDistribution = new System::Windows::Forms::TextBox();
			this->tBoxStorageTerm = new System::Windows::Forms::TextBox();
			this->tBoxMaximumStorage = new System::Windows::Forms::TextBox();
			this->tBoxBatch = new System::Windows::Forms::TextBox();
			this->label26 = new System::Windows::Forms::Label();
			this->tBoxMinimumStorage = new System::Windows::Forms::TextBox();
			this->label27 = new System::Windows::Forms::Label();
			this->label28 = new System::Windows::Forms::Label();
			this->label19 = new System::Windows::Forms::Label();
			this->label21 = new System::Windows::Forms::Label();
			this->tBoxMinimumPack = new System::Windows::Forms::TextBox();
			this->tBoxProduceCycle = new System::Windows::Forms::TextBox();
			this->tBoxImportAhead = new System::Windows::Forms::TextBox();
			this->tBoxRank = new System::Windows::Forms::TextBox();
			this->label22 = new System::Windows::Forms::Label();
			this->tBoxPrepareCycle = new System::Windows::Forms::TextBox();
			this->label23 = new System::Windows::Forms::Label();
			this->label24 = new System::Windows::Forms::Label();
			this->label16 = new System::Windows::Forms::Label();
			this->label17 = new System::Windows::Forms::Label();
			this->label18 = new System::Windows::Forms::Label();
			this->tBoxBrand = new System::Windows::Forms::TextBox();
			this->tBoxNetWeight = new System::Windows::Forms::TextBox();
			this->tBoxColour = new System::Windows::Forms::TextBox();
			this->tBoxWidth = new System::Windows::Forms::TextBox();
			this->tBoxLong = new System::Windows::Forms::TextBox();
			this->label13 = new System::Windows::Forms::Label();
			this->tBoxHeight = new System::Windows::Forms::TextBox();
			this->label14 = new System::Windows::Forms::Label();
			this->label15 = new System::Windows::Forms::Label();
			this->tBoxProperty4 = new System::Windows::Forms::TextBox();
			this->tBoxProperty2 = new System::Windows::Forms::TextBox();
			this->tBoxProperty1 = new System::Windows::Forms::TextBox();
			this->label12 = new System::Windows::Forms::Label();
			this->tBoxProperty3 = new System::Windows::Forms::TextBox();
			this->label8 = new System::Windows::Forms::Label();
			this->cmbPlanType = new System::Windows::Forms::ComboBox();
			this->tBoxRecordDate = new System::Windows::Forms::TextBox();
			this->tBoxModel = new System::Windows::Forms::TextBox();
			this->label9 = new System::Windows::Forms::Label();
			this->tBoxRecorder = new System::Windows::Forms::TextBox();
			this->label10 = new System::Windows::Forms::Label();
			this->label11 = new System::Windows::Forms::Label();
			this->label3 = new System::Windows::Forms::Label();
			this->cmbUnit = new System::Windows::Forms::ComboBox();
			this->tBoxMateriaNameDisplay = new System::Windows::Forms::TextBox();
			this->tBoxMaterialIDDisplay = new System::Windows::Forms::TextBox();
			this->label5 = new System::Windows::Forms::Label();
			this->tBoxMaterialWordDisplay = new System::Windows::Forms::TextBox();
			this->label6 = new System::Windows::Forms::Label();
			this->label7 = new System::Windows::Forms::Label();
			this->imageList1 = new System::Windows::Forms::ImageList(this->components);
			this->groupBox1->SuspendLayout();
			(__try_cast<System::ComponentModel::ISupportInitialize *  >(this->dgrdMaterials))->BeginInit();
			this->groupBox2->SuspendLayout();
			this->SuspendLayout();
			// 
			// toolBar1
			// 
			System::Windows::Forms::ToolBarButton* __mcTemp__1[] = new System::Windows::Forms::ToolBarButton*[10];
			__mcTemp__1[0] = this->tBtnFirstRecord;
			__mcTemp__1[1] = this->tBtnPreviousRecord;
			__mcTemp__1[2] = this->tBtnNextRecord;
			__mcTemp__1[3] = this->tBtnLastRecord;
			__mcTemp__1[4] = this->tBtnNewRecord;

⌨️ 快捷键说明

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