jj 15.03 datagridview can add rows
This commit is contained in:
@@ -220,9 +220,54 @@ Public Class ClassControlBuilder
|
||||
Case "CheckedListBoxControl"
|
||||
Dim chklistbox As DevExpress.XtraEditors.CheckedListBoxControl = CType(control, DevExpress.XtraEditors.CheckedListBoxControl)
|
||||
AddHandler chklistbox.ItemCheck, AddressOf RecordChanged
|
||||
'Case "DataGridView"
|
||||
' Dim gridview As DataGridView = CType(control, DataGridView)
|
||||
' AddHandler gridview.UserDeletingRow, AddressOf UserDeletingRow
|
||||
' AddHandler gridview.CellEndEdit, AddressOf CellEndEdit
|
||||
End Select
|
||||
End Sub
|
||||
|
||||
'Private Function GetAllItems(dgv As DataGridView) As List(Of String)
|
||||
' Dim list As New List(Of String)
|
||||
|
||||
' For Each row As DataGridViewRow In dgv.Rows
|
||||
' Dim cell As DataGridViewCell = row.Cells(0)
|
||||
' If Not IsNothing(cell.Value) Then
|
||||
' list.Add(cell.Value)
|
||||
' End If
|
||||
' Next
|
||||
|
||||
' Return list
|
||||
'End Function
|
||||
|
||||
'Private Sub SaveAllItems(controlId As Integer, items As String)
|
||||
' Try
|
||||
' Dim SQL As String = String.Format("UPDATE TBPMO_CONTROL SET STATIC_LIST='{0}' WHERE GUID = {1}", items, controlId)
|
||||
' ClassDatabase.Execute_non_Query(SQL)
|
||||
' Catch ex As Exception
|
||||
' MsgBox("Error in SaveAllItems:" & vbNewLine & ex.Message)
|
||||
' End Try
|
||||
'End Sub
|
||||
|
||||
'Private Sub UserDeletingRow(ByVal sender As Object, ByVal e As DataGridViewRowCancelEventArgs)
|
||||
' Dim dgv As DataGridView = DirectCast(sender, DataGridView)
|
||||
' Dim id As Integer = DirectCast(dgv.Tag, ClassControlMetadata).Id
|
||||
' Dim list As List(Of String) = GetAllItems(dgv)
|
||||
' list.RemoveAt(e.Row.Index)
|
||||
' Dim items As String = String.Join(";", list.ToArray())
|
||||
|
||||
' SaveAllItems(id, items)
|
||||
'End Sub
|
||||
|
||||
'Private Sub CellEndEdit(ByVal sender As Object, e As DataGridViewCellEventArgs)
|
||||
' Dim dgv As DataGridView = DirectCast(sender, DataGridView)
|
||||
' Dim id As Integer = DirectCast(dgv.Tag, ClassControlMetadata).Id
|
||||
' Dim list As List(Of String) = GetAllItems(dgv)
|
||||
' Dim items As String = String.Join(";", list.ToArray())
|
||||
|
||||
' SaveAllItems(id, items)
|
||||
'End Sub
|
||||
|
||||
Private Sub SetDragDropHandler(groupbox As GroupBox)
|
||||
If Not IsNothing(_group_box_drag_drop_handler) Then
|
||||
AddHandler groupbox.DragDrop, Me._group_box_drag_drop_handler
|
||||
@@ -1096,18 +1141,16 @@ Public Class ClassControlBuilder
|
||||
|
||||
control.Name = name
|
||||
control.BackgroundColor = SystemColors.ControlDark
|
||||
control.AllowUserToAddRows = False
|
||||
control.AllowUserToDeleteRows = False
|
||||
control.AllowUserToAddRows = True
|
||||
control.AllowUserToDeleteRows = True
|
||||
control.AllowUserToResizeColumns = False
|
||||
control.AllowUserToResizeRows = False
|
||||
control.Parent = _master_panel
|
||||
control.ReadOnly = read_only
|
||||
|
||||
|
||||
|
||||
'column.HeaderText = ""
|
||||
'column.Name = "column1"
|
||||
'control.Columns.Add(column)
|
||||
column.HeaderText = "Data"
|
||||
column.Name = "column1"
|
||||
control.Columns.Add(column)
|
||||
|
||||
If _new And IsNothing(parent) Then
|
||||
control.Location = Me.GetCursorPosition()
|
||||
|
||||
Reference in New Issue
Block a user