From cf27b190876b20818c4e57541c929a3ebb08104c Mon Sep 17 00:00:00 2001 From: Blauschleim Date: Mon, 9 May 2022 13:47:36 +0200 Subject: [PATCH] added columns for user controll --- Form1.Designer.cs | 46 ++++++++++++++++++++++++++++++++++++++++++++++ Form1.cs | 5 ++++- Form1.resx | 15 +++++++++++++++ 3 files changed, 65 insertions(+), 1 deletion(-) diff --git a/Form1.Designer.cs b/Form1.Designer.cs index 0f6f0eb..6a8ec5c 100644 --- a/Form1.Designer.cs +++ b/Form1.Designer.cs @@ -37,6 +37,11 @@ namespace it_projekt this.passTxt = new System.Windows.Forms.TextBox(); this.sqlTxt = new System.Windows.Forms.TextBox(); this.dataGrid = new System.Windows.Forms.DataGridView(); + this.Id = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.firstname = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.lastname = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.creationDate = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.markItem = new System.Windows.Forms.DataGridViewCheckBoxColumn(); ((System.ComponentModel.ISupportInitialize)(this.dataGrid)).BeginInit(); this.SuspendLayout(); // @@ -104,11 +109,47 @@ namespace it_projekt // this.dataGrid.AllowUserToOrderColumns = true; this.dataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGrid.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] { + this.Id, + this.firstname, + this.lastname, + this.creationDate, + this.markItem}); this.dataGrid.Location = new System.Drawing.Point(12, 213); this.dataGrid.Name = "dataGrid"; this.dataGrid.RowTemplate.Height = 25; this.dataGrid.Size = new System.Drawing.Size(771, 225); this.dataGrid.TabIndex = 7; + this.dataGrid.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGrid_CellContentClick); + // + // Id + // + this.Id.HeaderText = "NutzerId"; + this.Id.Name = "Id"; + this.Id.ReadOnly = true; + // + // firstname + // + this.firstname.HeaderText = "Vorname"; + this.firstname.Name = "firstname"; + this.firstname.ReadOnly = true; + // + // lastname + // + this.lastname.HeaderText = "Nachname"; + this.lastname.Name = "lastname"; + this.lastname.ReadOnly = true; + // + // creationDate + // + this.creationDate.HeaderText = "Erstellungssdatum"; + this.creationDate.Name = "creationDate"; + this.creationDate.ReadOnly = true; + // + // markItem + // + this.markItem.HeaderText = "User Auswählen"; + this.markItem.Name = "markItem"; // // Form1 // @@ -141,6 +182,11 @@ namespace it_projekt private System.Windows.Forms.TextBox passTxt; private System.Windows.Forms.TextBox sqlTxt; private System.Windows.Forms.DataGridView dataGrid; + private System.Windows.Forms.DataGridViewTextBoxColumn Id; + private System.Windows.Forms.DataGridViewTextBoxColumn firstname; + private System.Windows.Forms.DataGridViewTextBoxColumn lastname; + private System.Windows.Forms.DataGridViewTextBoxColumn creationDate; + private System.Windows.Forms.DataGridViewCheckBoxColumn markItem; } } diff --git a/Form1.cs b/Form1.cs index 51dcf2b..d182f35 100644 --- a/Form1.cs +++ b/Form1.cs @@ -39,6 +39,9 @@ namespace it_projekt MessageBox.Show(test.persons.Find(1).Firstname); } - + private void dataGrid_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + + } } } diff --git a/Form1.resx b/Form1.resx index f298a7b..11cd2a1 100644 --- a/Form1.resx +++ b/Form1.resx @@ -57,4 +57,19 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + True + + + True + + + True + + + True + + + True + \ No newline at end of file