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

📄 courseselect.h

📁 Visual C++.net数据库开发经典案例
💻 H
📖 第 1 页 / 共 2 页
字号:
#pragma once
#include "LinkDataBase.h"
#include "DataGridNoActiveCellColumn.h"
#include "CurriculumSchedule.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> 
	/// CourseSelect 摘要
	///
	/// 警告: 如果您更改该类的名称,则将需要更改 
	///          与该类所依赖的所有 .resx 文件关联的托管资源编译器工具的 
	///          “资源文件名”属性。  否则,
	///          设计器将不能与此窗体关联的
	///          本地化资源正确交互。
	/// </summary>
	public __gc class CourseSelect : public System::Windows::Forms::Form
	{
		//--------------------成员声明------------------------
	private:
		LinkDataBase* MyDataBase;	//数据库连接类
		SqlDataAdapter* CourseAdapter;
		DataSet* ds;
		String* strTableName;
		String* strSQL;
	private: System::Windows::Forms::Button *  btnCourseTable;
	private: System::Windows::Forms::Button *  btnDeSelect;
	private: System::Windows::Forms::Button *  btnSelect;
	private: System::Windows::Forms::Button *  btnSearch;
	private: System::Windows::Forms::DataGrid *  dataGrid1;
			 DataView* CourseView;
		//-------------------成员声明结束-----------------------
	public: 
		CourseSelect(void)
		{
			InitializeComponent();
			//初始化
			this->MyDataBase = new LinkDataBase();
			this->ds = new DataSet();
			this->CourseAdapter = new SqlDataAdapter();
			CourseView = new DataView();

			//查询本学期课程
			this->strSQL = S"SELECT 课程表.课序号, 课程表.课程编号, 课程信息.课程名称, 课程信息.教师,课程信息.开课系别, 课程表.上课时间天, 课程表.上课时间节, 课程表.上课地点, 课程信息.拼音码, 课程信息.学分 FROM 课程信息 INNER JOIN 课程表 ON 课程信息.课程编号 = 课程表.课程编号 WHERE (课程信息.本学期课程 = 'Y')";
			this->strTableName = S"本学期课程";
			this->MyDataBase->SelectDataBase(this->CourseAdapter,this->ds,this->strSQL,this->strTableName);

			//设置DataGrid
			this->CourseView->Table = this->ds->Tables->Item[S"本学期课程"];
			this->dgrdCourse->DataSource = this->CourseView;
			this->DataGridStateCourse();

					
			//设置控件ReadOnly属性
			this->SetModify(false);
		}
        
	protected: 
		void Dispose(Boolean disposing)
		{
			if (disposing && components)
			{
				components->Dispose();
			}
			__super::Dispose(disposing);
		}
	private: System::Windows::Forms::GroupBox *  groupBox1;
	private: System::Windows::Forms::TextBox *  tBoxName;
	private: System::Windows::Forms::Label *  label2;
	private: System::Windows::Forms::TextBox *  tBoxStudentID;
	private: System::Windows::Forms::Label *  label1;

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

	private: System::Windows::Forms::GroupBox *  groupBox3;





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

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

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

	private: System::Windows::Forms::Label *  label5;
	protected: System::Windows::Forms::ImageList *  imageList1;
	private: System::Windows::Forms::TextBox *  tBoxClass;
	private: System::Windows::Forms::DataGrid *  dgrdCourseSelected;
	private: System::Windows::Forms::DataGrid *  dgrdCourse;
	private: System::Windows::Forms::TextBox *  tBoxPinYin;
	private: System::Windows::Forms::TextBox *  tBoxCourseName;
	private: System::Windows::Forms::TextBox *  tBoxCourseID;
	private: System::Windows::Forms::TextBox *  tBoxSubID;

	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::CourseSelect));
			this->groupBox1 = new System::Windows::Forms::GroupBox();
			this->tBoxName = new System::Windows::Forms::TextBox();
			this->label2 = new System::Windows::Forms::Label();
			this->tBoxStudentID = new System::Windows::Forms::TextBox();
			this->label1 = new System::Windows::Forms::Label();
			this->tBoxClass = new System::Windows::Forms::TextBox();
			this->label4 = new System::Windows::Forms::Label();
			this->dgrdCourseSelected = new System::Windows::Forms::DataGrid();
			this->groupBox2 = new System::Windows::Forms::GroupBox();
			this->dgrdCourse = new System::Windows::Forms::DataGrid();
			this->groupBox3 = new System::Windows::Forms::GroupBox();
			this->btnCourseTable = new System::Windows::Forms::Button();
			this->imageList1 = new System::Windows::Forms::ImageList(this->components);
			this->btnDeSelect = new System::Windows::Forms::Button();
			this->btnSelect = new System::Windows::Forms::Button();
			this->btnSearch = new System::Windows::Forms::Button();
			this->tBoxPinYin = new System::Windows::Forms::TextBox();
			this->label13 = new System::Windows::Forms::Label();
			this->tBoxCourseName = new System::Windows::Forms::TextBox();
			this->label9 = new System::Windows::Forms::Label();
			this->tBoxSubID = new System::Windows::Forms::TextBox();
			this->label10 = new System::Windows::Forms::Label();
			this->tBoxCourseID = new System::Windows::Forms::TextBox();
			this->label5 = new System::Windows::Forms::Label();
			this->dataGrid1 = new System::Windows::Forms::DataGrid();
			this->groupBox1->SuspendLayout();
			(__try_cast<System::ComponentModel::ISupportInitialize *  >(this->dgrdCourseSelected))->BeginInit();
			this->groupBox2->SuspendLayout();
			(__try_cast<System::ComponentModel::ISupportInitialize *  >(this->dgrdCourse))->BeginInit();
			this->groupBox3->SuspendLayout();
			(__try_cast<System::ComponentModel::ISupportInitialize *  >(this->dataGrid1))->BeginInit();
			this->SuspendLayout();
			// 
			// groupBox1
			// 
			this->groupBox1->Controls->Add(this->tBoxName);
			this->groupBox1->Controls->Add(this->label2);
			this->groupBox1->Controls->Add(this->tBoxStudentID);
			this->groupBox1->Controls->Add(this->label1);
			this->groupBox1->Controls->Add(this->tBoxClass);
			this->groupBox1->Controls->Add(this->label4);
			this->groupBox1->Dock = System::Windows::Forms::DockStyle::Top;
			this->groupBox1->Location = System::Drawing::Point(0, 0);
			this->groupBox1->Name = S"groupBox1";
			this->groupBox1->Size = System::Drawing::Size(752, 64);
			this->groupBox1->TabIndex = 1;
			this->groupBox1->TabStop = false;
			// 
			// tBoxName
			// 
			this->tBoxName->Location = System::Drawing::Point(344, 28);
			this->tBoxName->Name = S"tBoxName";
			this->tBoxName->ReadOnly = true;
			this->tBoxName->Size = System::Drawing::Size(120, 21);
			this->tBoxName->TabIndex = 10;
			this->tBoxName->Text = S"";
			// 
			// label2
			// 
			this->label2->Location = System::Drawing::Point(280, 33);
			this->label2->Name = S"label2";
			this->label2->Size = System::Drawing::Size(56, 11);
			this->label2->TabIndex = 9;
			this->label2->Text = S"姓名";
			// 
			// tBoxStudentID
			// 
			this->tBoxStudentID->Location = System::Drawing::Point(144, 29);
			this->tBoxStudentID->Name = S"tBoxStudentID";
			this->tBoxStudentID->Size = System::Drawing::Size(120, 21);
			this->tBoxStudentID->TabIndex = 8;
			this->tBoxStudentID->Text = S"";
			this->tBoxStudentID->KeyPress += new System::Windows::Forms::KeyPressEventHandler(this, tBoxStudentID_KeyPress);
			// 
			// label1
			// 
			this->label1->Location = System::Drawing::Point(80, 34);
			this->label1->Name = S"label1";
			this->label1->Size = System::Drawing::Size(56, 11);
			this->label1->TabIndex = 7;
			this->label1->Text = S"学号";
			// 
			// tBoxClass
			// 
			this->tBoxClass->Location = System::Drawing::Point(561, 29);
			this->tBoxClass->Name = S"tBoxClass";
			this->tBoxClass->ReadOnly = true;
			this->tBoxClass->Size = System::Drawing::Size(120, 21);
			this->tBoxClass->TabIndex = 12;
			this->tBoxClass->Text = S"";
			// 
			// label4
			// 
			this->label4->Location = System::Drawing::Point(495, 32);
			this->label4->Name = S"label4";
			this->label4->Size = System::Drawing::Size(56, 11);
			this->label4->TabIndex = 11;
			this->label4->Text = S"班级";
			// 
			// dgrdCourseSelected
			// 
			this->dgrdCourseSelected->CaptionText = S"已选课程";
			this->dgrdCourseSelected->DataMember = S"";
			this->dgrdCourseSelected->Dock = System::Windows::Forms::DockStyle::Fill;
			this->dgrdCourseSelected->HeaderForeColor = System::Drawing::SystemColors::ControlText;
			this->dgrdCourseSelected->Location = System::Drawing::Point(0, 64);
			this->dgrdCourseSelected->Name = S"dgrdCourseSelected";
			this->dgrdCourseSelected->Size = System::Drawing::Size(752, 405);
			this->dgrdCourseSelected->TabIndex = 2;
			// 
			// groupBox2
			// 
			this->groupBox2->Controls->Add(this->dgrdCourse);
			this->groupBox2->Controls->Add(this->groupBox3);
			this->groupBox2->Dock = System::Windows::Forms::DockStyle::Bottom;
			this->groupBox2->Location = System::Drawing::Point(0, 197);
			this->groupBox2->Name = S"groupBox2";
			this->groupBox2->Size = System::Drawing::Size(752, 272);
			this->groupBox2->TabIndex = 3;
			this->groupBox2->TabStop = false;
			this->groupBox2->Text = S"课程信息";
			// 
			// dgrdCourse
			// 
			this->dgrdCourse->DataMember = S"";
			this->dgrdCourse->Dock = System::Windows::Forms::DockStyle::Fill;
			this->dgrdCourse->HeaderForeColor = System::Drawing::SystemColors::ControlText;
			this->dgrdCourse->Location = System::Drawing::Point(256, 17);
			this->dgrdCourse->Name = S"dgrdCourse";
			this->dgrdCourse->Size = System::Drawing::Size(493, 252);
			this->dgrdCourse->TabIndex = 6;
			// 
			// groupBox3
			// 
			this->groupBox3->Controls->Add(this->btnCourseTable);
			this->groupBox3->Controls->Add(this->btnDeSelect);
			this->groupBox3->Controls->Add(this->btnSelect);
			this->groupBox3->Controls->Add(this->btnSearch);
			this->groupBox3->Controls->Add(this->tBoxPinYin);
			this->groupBox3->Controls->Add(this->label13);
			this->groupBox3->Controls->Add(this->tBoxCourseName);
			this->groupBox3->Controls->Add(this->label9);
			this->groupBox3->Controls->Add(this->tBoxSubID);
			this->groupBox3->Controls->Add(this->label10);
			this->groupBox3->Controls->Add(this->tBoxCourseID);
			this->groupBox3->Controls->Add(this->label5);
			this->groupBox3->Dock = System::Windows::Forms::DockStyle::Left;
			this->groupBox3->Location = System::Drawing::Point(3, 17);
			this->groupBox3->Name = S"groupBox3";
			this->groupBox3->Size = System::Drawing::Size(253, 252);
			this->groupBox3->TabIndex = 5;
			this->groupBox3->TabStop = false;
			// 
			// btnCourseTable
			// 
			this->btnCourseTable->Enabled = false;
			this->btnCourseTable->ImageAlign = System::Drawing::ContentAlignment::MiddleLeft;
			this->btnCourseTable->ImageIndex = 12;
			this->btnCourseTable->ImageList = this->imageList1;
			this->btnCourseTable->Location = System::Drawing::Point(136, 208);
			this->btnCourseTable->Name = S"btnCourseTable";
			this->btnCourseTable->Size = System::Drawing::Size(64, 24);
			this->btnCourseTable->TabIndex = 69;
			this->btnCourseTable->Text = S"看课表";
			this->btnCourseTable->TextAlign = System::Drawing::ContentAlignment::MiddleRight;
			this->btnCourseTable->Click += new System::EventHandler(this, btnCourseTable_Click);
			// 
			// imageList1
			// 
			this->imageList1->ImageSize = System::Drawing::Size(16, 16);
			this->imageList1->ImageStream = (__try_cast<System::Windows::Forms::ImageListStreamer *  >(resources->GetObject(S"imageList1.ImageStream")));
			this->imageList1->TransparentColor = System::Drawing::Color::Transparent;
			// 
			// btnDeSelect
			// 
			this->btnDeSelect->Enabled = false;
			this->btnDeSelect->ImageAlign = System::Drawing::ContentAlignment::MiddleLeft;
			this->btnDeSelect->ImageIndex = 3;
			this->btnDeSelect->ImageList = this->imageList1;
			this->btnDeSelect->Location = System::Drawing::Point(24, 208);
			this->btnDeSelect->Name = S"btnDeSelect";
			this->btnDeSelect->Size = System::Drawing::Size(64, 24);
			this->btnDeSelect->TabIndex = 68;
			this->btnDeSelect->Text = S"删课";
			this->btnDeSelect->TextAlign = System::Drawing::ContentAlignment::MiddleRight;
			this->btnDeSelect->Click += new System::EventHandler(this, btnDeSelect_Click);
			// 
			// btnSelect
			// 
			this->btnSelect->Enabled = false;
			this->btnSelect->ImageAlign = System::Drawing::ContentAlignment::MiddleLeft;
			this->btnSelect->ImageIndex = 0;
			this->btnSelect->ImageList = this->imageList1;
			this->btnSelect->Location = System::Drawing::Point(136, 168);
			this->btnSelect->Name = S"btnSelect";
			this->btnSelect->Size = System::Drawing::Size(64, 24);
			this->btnSelect->TabIndex = 67;
			this->btnSelect->Text = S"选课";
			this->btnSelect->TextAlign = System::Drawing::ContentAlignment::MiddleRight;
			this->btnSelect->Click += new System::EventHandler(this, btnSelect_Click);
			// 

⌨️ 快捷键说明

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