adds deletion of row via rightclick, default colors for gridview

master
Dominic Reich 9 years ago
parent ab292cae2a
commit 504d060711

Binary file not shown.

@ -12,7 +12,7 @@
<xs:element name="GästeDataSet" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:EnableTableAdapterManager="true" msprop:Generator_DataSetName="GästeDataSet" msprop:Generator_UserDSName="GästeDataSet">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="Gäste" msdata:CaseSensitive="False" msprop:Generator_TableClassName="GästeDataTable" msprop:Generator_TableVarName="tableGäste" msprop:Generator_RowChangedName="GästeRowChanged" msprop:Generator_TablePropName="Gäste" msprop:Generator_RowDeletingName="GästeRowDeleting" msprop:Generator_RowChangingName="GästeRowChanging" msprop:Generator_RowEvHandlerName="GästeRowChangeEventHandler" msprop:Generator_RowDeletedName="GästeRowDeleted" msprop:Generator_RowClassName="GästeRow" msprop:Generator_UserTableName="Gäste" msprop:Generator_RowEvArgName="GästeRowChangeEvent">
<xs:element name="Gäste" msdata:CaseSensitive="False" msprop:Generator_TableClassName="GästeDataTable" msprop:Generator_TableVarName="tableGäste" msprop:Generator_TablePropName="Gäste" msprop:Generator_RowDeletingName="GästeRowDeleting" msprop:Generator_RowChangingName="GästeRowChanging" msprop:Generator_RowEvHandlerName="GästeRowChangeEventHandler" msprop:Generator_RowDeletedName="GästeRowDeleted" msprop:Generator_UserTableName="Gäste" msprop:Generator_RowChangedName="GästeRowChanged" msprop:Generator_RowEvArgName="GästeRowChangeEvent" msprop:Generator_RowClassName="GästeRow">
<xs:complexType>
<xs:sequence>
<xs:element name="ID" msdata:AutoIncrement="true" msdata:AutoIncrementSeed="1" msprop:Generator_ColumnVarNameInTable="columnID" msprop:Generator_ColumnPropNameInRow="ID" msprop:Generator_ColumnPropNameInTable="IDColumn" msprop:Generator_UserColumnName="ID" type="xs:int" />

@ -24,9 +24,15 @@ Partial Class frmMain
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmMain))
Me.GästeBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.GästeDataSet = New Gästeliste.GästeDataSet()
Me.DataGridView1 = New System.Windows.Forms.DataGridView()
Me.mnuMain = New System.Windows.Forms.MenuStrip()
Me.HilfeToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.InfoToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.ToolStripMenuItem1 = New System.Windows.Forms.ToolStripSeparator()
Me.HilfePerEmailAnfordernToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.FehlerMeldenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.mnuContext = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.EintragLöschenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.IDDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.NachnameDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.VornameDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn()
@ -39,29 +45,16 @@ Partial Class frmMain
Me.StammgastDataGridViewCheckBoxColumn = New System.Windows.Forms.DataGridViewCheckBoxColumn()
Me.BlockiertDataGridViewCheckBoxColumn = New System.Windows.Forms.DataGridViewCheckBoxColumn()
Me.AnmerkungDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.mnuMain = New System.Windows.Forms.MenuStrip()
Me.HilfeToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.InfoToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.ToolStripMenuItem1 = New System.Windows.Forms.ToolStripSeparator()
Me.HilfePerEmailAnfordernToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.FehlerMeldenToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.mnuContext = New System.Windows.Forms.ContextMenuStrip(Me.components)
CType(Me.GästeBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.GästeDataSet, System.ComponentModel.ISupportInitialize).BeginInit()
Me.GästeBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.GästeDataSet = New Gästeliste.GästeDataSet()
Me.OnlineHilfeToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.mnuMain.SuspendLayout()
Me.mnuContext.SuspendLayout()
CType(Me.GästeBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.GästeDataSet, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'GästeBindingSource
'
Me.GästeBindingSource.DataMember = "Gäste"
Me.GästeBindingSource.DataSource = Me.GästeDataSet
'
'GästeDataSet
'
Me.GästeDataSet.DataSetName = "GästeDataSet"
Me.GästeDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema
'
'DataGridView1
'
Me.DataGridView1.AllowUserToResizeRows = False
@ -77,6 +70,57 @@ Partial Class frmMain
Me.DataGridView1.Size = New System.Drawing.Size(818, 483)
Me.DataGridView1.TabIndex = 4
'
'mnuMain
'
Me.mnuMain.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.HilfeToolStripMenuItem})
Me.mnuMain.Location = New System.Drawing.Point(0, 0)
Me.mnuMain.Name = "mnuMain"
Me.mnuMain.Size = New System.Drawing.Size(818, 24)
Me.mnuMain.TabIndex = 5
Me.mnuMain.Text = "MenuStrip1"
'
'HilfeToolStripMenuItem
'
Me.HilfeToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.InfoToolStripMenuItem, Me.OnlineHilfeToolStripMenuItem, Me.ToolStripMenuItem1, Me.HilfePerEmailAnfordernToolStripMenuItem, Me.FehlerMeldenToolStripMenuItem})
Me.HilfeToolStripMenuItem.Name = "HilfeToolStripMenuItem"
Me.HilfeToolStripMenuItem.Size = New System.Drawing.Size(44, 20)
Me.HilfeToolStripMenuItem.Text = "Hilfe"
'
'InfoToolStripMenuItem
'
Me.InfoToolStripMenuItem.Name = "InfoToolStripMenuItem"
Me.InfoToolStripMenuItem.Size = New System.Drawing.Size(206, 22)
Me.InfoToolStripMenuItem.Text = "Info"
'
'ToolStripMenuItem1
'
Me.ToolStripMenuItem1.Name = "ToolStripMenuItem1"
Me.ToolStripMenuItem1.Size = New System.Drawing.Size(203, 6)
'
'HilfePerEmailAnfordernToolStripMenuItem
'
Me.HilfePerEmailAnfordernToolStripMenuItem.Name = "HilfePerEmailAnfordernToolStripMenuItem"
Me.HilfePerEmailAnfordernToolStripMenuItem.Size = New System.Drawing.Size(206, 22)
Me.HilfePerEmailAnfordernToolStripMenuItem.Text = "Hilfe per Email anfordern"
'
'FehlerMeldenToolStripMenuItem
'
Me.FehlerMeldenToolStripMenuItem.Name = "FehlerMeldenToolStripMenuItem"
Me.FehlerMeldenToolStripMenuItem.Size = New System.Drawing.Size(206, 22)
Me.FehlerMeldenToolStripMenuItem.Text = "Fehler melden"
'
'mnuContext
'
Me.mnuContext.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.EintragLöschenToolStripMenuItem})
Me.mnuContext.Name = "mnuContext"
Me.mnuContext.Size = New System.Drawing.Size(156, 26)
'
'EintragLöschenToolStripMenuItem
'
Me.EintragLöschenToolStripMenuItem.Name = "EintragLöschenToolStripMenuItem"
Me.EintragLöschenToolStripMenuItem.Size = New System.Drawing.Size(155, 22)
Me.EintragLöschenToolStripMenuItem.Text = "Eintrag löschen"
'
'IDDataGridViewTextBoxColumn
'
Me.IDDataGridViewTextBoxColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells
@ -172,49 +216,21 @@ Partial Class frmMain
Me.AnmerkungDataGridViewTextBoxColumn.Name = "AnmerkungDataGridViewTextBoxColumn"
Me.AnmerkungDataGridViewTextBoxColumn.Width = 200
'
'mnuMain
'
Me.mnuMain.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.HilfeToolStripMenuItem})
Me.mnuMain.Location = New System.Drawing.Point(0, 0)
Me.mnuMain.Name = "mnuMain"
Me.mnuMain.Size = New System.Drawing.Size(818, 24)
Me.mnuMain.TabIndex = 5
Me.mnuMain.Text = "MenuStrip1"
'
'HilfeToolStripMenuItem
'
Me.HilfeToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.InfoToolStripMenuItem, Me.ToolStripMenuItem1, Me.HilfePerEmailAnfordernToolStripMenuItem, Me.FehlerMeldenToolStripMenuItem})
Me.HilfeToolStripMenuItem.Name = "HilfeToolStripMenuItem"
Me.HilfeToolStripMenuItem.Size = New System.Drawing.Size(44, 20)
Me.HilfeToolStripMenuItem.Text = "Hilfe"
'
'InfoToolStripMenuItem
'
Me.InfoToolStripMenuItem.Name = "InfoToolStripMenuItem"
Me.InfoToolStripMenuItem.Size = New System.Drawing.Size(206, 22)
Me.InfoToolStripMenuItem.Text = "Info"
'
'ToolStripMenuItem1
'
Me.ToolStripMenuItem1.Name = "ToolStripMenuItem1"
Me.ToolStripMenuItem1.Size = New System.Drawing.Size(203, 6)
'
'HilfePerEmailAnfordernToolStripMenuItem
'GästeBindingSource
'
Me.HilfePerEmailAnfordernToolStripMenuItem.Name = "HilfePerEmailAnfordernToolStripMenuItem"
Me.HilfePerEmailAnfordernToolStripMenuItem.Size = New System.Drawing.Size(206, 22)
Me.HilfePerEmailAnfordernToolStripMenuItem.Text = "Hilfe per Email anfordern"
Me.GästeBindingSource.DataMember = "Gäste"
Me.GästeBindingSource.DataSource = Me.GästeDataSet
'
'FehlerMeldenToolStripMenuItem
'GästeDataSet
'
Me.FehlerMeldenToolStripMenuItem.Name = "FehlerMeldenToolStripMenuItem"
Me.FehlerMeldenToolStripMenuItem.Size = New System.Drawing.Size(206, 22)
Me.FehlerMeldenToolStripMenuItem.Text = "Fehler melden"
Me.GästeDataSet.DataSetName = "GästeDataSet"
Me.GästeDataSet.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema
'
'mnuContext
'OnlineHilfeToolStripMenuItem
'
Me.mnuContext.Name = "mnuContext"
Me.mnuContext.Size = New System.Drawing.Size(61, 4)
Me.OnlineHilfeToolStripMenuItem.Name = "OnlineHilfeToolStripMenuItem"
Me.OnlineHilfeToolStripMenuItem.Size = New System.Drawing.Size(206, 22)
Me.OnlineHilfeToolStripMenuItem.Text = "Online-Hilfe"
'
'frmMain
'
@ -227,11 +243,12 @@ Partial Class frmMain
Me.MainMenuStrip = Me.mnuMain
Me.Name = "frmMain"
Me.Text = "Gästeliste"
CType(Me.GästeBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.GästeDataSet, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).EndInit()
Me.mnuMain.ResumeLayout(False)
Me.mnuMain.PerformLayout()
Me.mnuContext.ResumeLayout(False)
CType(Me.GästeBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.GästeDataSet, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
@ -259,4 +276,6 @@ Partial Class frmMain
Friend WithEvents ToolStripMenuItem1 As ToolStripSeparator
Friend WithEvents FehlerMeldenToolStripMenuItem As ToolStripMenuItem
Friend WithEvents mnuContext As ContextMenuStrip
Friend WithEvents EintragLöschenToolStripMenuItem As ToolStripMenuItem
Friend WithEvents OnlineHilfeToolStripMenuItem As ToolStripMenuItem
End Class

@ -2,6 +2,7 @@
Public Class frmMain
Private _dataPath As String = System.IO.Path.Combine(My.Computer.FileSystem.SpecialDirectories.MyDocuments, "Gästeliste.xml")
Private _rowIndex As Integer = 0
Private Sub frmMain_Closing(sender As Object, e As CancelEventArgs) Handles Me.Closing
Me.GästeDataSet.WriteXml(_dataPath)
@ -13,6 +14,10 @@ Public Class frmMain
Catch ex As Exception
' do nothing, that file gets created when we close the application ;)
End Try
' Setting colors of grids to some fancy ones :)
Me.DataGridView1.RowsDefaultCellStyle.BackColor = Color.Azure
Me.DataGridView1.AlternatingRowsDefaultCellStyle.BackColor = Color.Beige
End Sub
Private Sub InfoToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles InfoToolStripMenuItem.Click
@ -34,5 +39,23 @@ Public Class frmMain
End If
End Sub
Private Sub DataGridView1_CellMouseUp(sender As Object, e As DataGridViewCellMouseEventArgs) Handles DataGridView1.CellMouseUp
If e.Button = MouseButtons.Right Then
Me.DataGridView1.Rows(e.RowIndex).Selected = True
Me._rowIndex = e.RowIndex
Me.DataGridView1.CurrentCell = Me.DataGridView1.Rows(e.RowIndex).Cells(1)
Me.mnuContext.Show(Me.DataGridView1, e.Location)
mnuContext.Show(Cursor.Position)
End If
End Sub
Private Sub EintragLöschenToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles EintragLöschenToolStripMenuItem.Click
If Not Me.DataGridView1.Rows(Me._rowIndex).IsNewRow Then
Me.DataGridView1.Rows.RemoveAt(Me._rowIndex)
End If
End Sub
Private Sub OnlineHilfeToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles OnlineHilfeToolStripMenuItem.Click
Process.Start("http://tmsn.at/?tools&gaesteliste&hilfe")
End Sub
End Class

Loading…
Cancel
Save