P
Peter
I have the following Class, but I would like to make one of the columns in
my DataGrid editable, how would I do that? When I use this class none of
the columns are editable even when I set the ReadOnly property to false?
Thanks
Peter
'-------------------------------------------------
Public Class MyDataGrid
Inherits DataGrid
Private _processVars As ProcessVariables
Private _sortDir As String = "NONE"
Private _sortVar As String = "NONE"
Protected Overrides Sub OnMouseDown(ByVal e As
System.Windows.Forms.MouseEventArgs)
Dim pt As New Point(e.X, e.Y)
Dim hit As DataGrid.HitTestInfo = Me.HitTest(pt)
If hit.Type = HitTestType.ColumnHeader AndAlso (hit.Column = 1 Or
hit.Column = 2) Then
Dim col As String =
Me.TableStyles(0).GridColumnStyles(hit.Column).MappingName
If Me._sortVar.Equals(col) Then
If hit.Column = 1 Then
If Me._sortDir.Equals("ASC") Then
Me._sortDir = "DESC"
ElseIf Me._sortDir = "DESC" Then
Me._sortDir = "NONE"
Else
Me._sortDir = "ASC"
End If
Else
If Me._sortDir.Equals("ASC") Then
Me._sortDir = "DESC"
Else
Me._sortDir = "ASC"
End If
End If
Else
Me._sortDir = "DESC"
Me._sortVar = col
End If
Me._processVars.SortGrid(Me, Me._sortDir, Me._sortVar)
Return 'don't call baseclass
End If
MyBase.OnMouseDown(e)
End Sub 'OnMouseDown
Public WriteOnly Property ProcessVars() As ProcessVariables
Set(ByVal Value As ProcessVariables)
Me._processVars = Value
End Set
End Property
End Class 'MyDataGrid
my DataGrid editable, how would I do that? When I use this class none of
the columns are editable even when I set the ReadOnly property to false?
Thanks
Peter
'-------------------------------------------------
Public Class MyDataGrid
Inherits DataGrid
Private _processVars As ProcessVariables
Private _sortDir As String = "NONE"
Private _sortVar As String = "NONE"
Protected Overrides Sub OnMouseDown(ByVal e As
System.Windows.Forms.MouseEventArgs)
Dim pt As New Point(e.X, e.Y)
Dim hit As DataGrid.HitTestInfo = Me.HitTest(pt)
If hit.Type = HitTestType.ColumnHeader AndAlso (hit.Column = 1 Or
hit.Column = 2) Then
Dim col As String =
Me.TableStyles(0).GridColumnStyles(hit.Column).MappingName
If Me._sortVar.Equals(col) Then
If hit.Column = 1 Then
If Me._sortDir.Equals("ASC") Then
Me._sortDir = "DESC"
ElseIf Me._sortDir = "DESC" Then
Me._sortDir = "NONE"
Else
Me._sortDir = "ASC"
End If
Else
If Me._sortDir.Equals("ASC") Then
Me._sortDir = "DESC"
Else
Me._sortDir = "ASC"
End If
End If
Else
Me._sortDir = "DESC"
Me._sortVar = col
End If
Me._processVars.SortGrid(Me, Me._sortDir, Me._sortVar)
Return 'don't call baseclass
End If
MyBase.OnMouseDown(e)
End Sub 'OnMouseDown
Public WriteOnly Property ProcessVars() As ProcessVariables
Set(ByVal Value As ProcessVariables)
Me._processVars = Value
End Set
End Property
End Class 'MyDataGrid