Hi Vadivel,
Using Flex Grid and Text Box I want to make a editable Flex Grid.
I had already make this type control through vb6 and it is working fine.
But When I am try to build the same type of control in
vb.net. It is build sycessfully. But When I try to use this control in
Vb.Net its thrown that error.
Sample Code:-----
#Region "Private Variable Declaration For Grid"
Private GridApperance As MSFlexGridLib.AppearanceSettings
Private UserResizing As MSFlexGridLib.AllowUserResizeSettings
Private HighLight As MSFlexGridLib.HighLightSettings
Private GridScrollBar As MSFlexGridLib.ScrollBarsSettings
Private GridSection As MSFlexGridLib.SelectionModeSettings
Private GridSort As MSFlexGridLib.SortSettings
Private GridText As MSFlexGridLib.TextStyleSettings
Private GridPicture As MSFlexGridLib.PictureTypeSettings
Private GridForMatString As String
Private MyGridColor As Color
Private HighlightColor As Color
Private FixedCColor As Color
Private MyGridBKG As Color
Private MyBackBolor As Color
Private TotFixedRow As Integer = 1
Private TotFixedCol As Integer = 1
Private RowNo As Integer = 1
Private ColNo As Integer = 2
Private FixedColWidth As Integer = 0
#End Region
#Region "Public Grid Property"
Public Property FixedColoumnWidth() As Integer
Get
Try
Return Me.FixedColWidth
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Get
Set(ByVal Value As Integer)
Try
FixedColWidth = Value
Me.ADONISFlexGrid.set_ColWidth(0, FixedColWidth)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Set
End Property
Public Property TotalColumnNo() As Integer
Get
Try
Return Me.ColNo
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Get
Set(ByVal Value As Integer)
Try
ColNo = Value
Me.ADONISFlexGrid.Cols = ColNo
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Set
End Property
Public Property TotalRowNo() As Integer
Get
Try
Return Me.RowNo
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Get
Set(ByVal Value As Integer)
Try
RowNo = Value
Me.ADONISFlexGrid.Rows = RowNo
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Set
End Property
Public Property FixedColNo() As Integer
Get
Try
Return Me.TotFixedCol
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Get
Set(ByVal Value As Integer)
Try
Me.TotFixedCol = Value
Me.ADONISFlexGrid.FixedCols = Me.TotFixedCol
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Set
End Property
Public Property FixedRowNo() As Integer
Get
Try
Return Me.TotFixedRow
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Get
Set(ByVal Value As Integer)
Try
Me.TotFixedRow = Value
Me.ADONISFlexGrid.FixedRows = Me.TotFixedRow
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Set
End Property
Public Property CustomeGridColor() As Color
Get
Try
Catch ex As Exception
End Try
End Get
Set(ByVal Value As Color)
Try
Catch ex As Exception
End Try
End Set
End Property
Public Property CustomeBackColor() As Color
Get
Try
Return Me.MyBackBolor
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Get
Set(ByVal Value As Color)
Try
Me.MyBackBolor = Value
Me.ADONISFlexGrid.BackColor = Me.MyBackBolor
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Set
End Property
Public Property GridBackGroundColor() As Color
Get
Try
Return Me.MyGridBKG
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Get
Set(ByVal Value As Color)
Try
Me.MyGridBKG = Value
Me.ADONISFlexGrid.BackColorBkg = Me.MyGridBKG
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Set
End Property
Public Property FixedControlColor() As Color
Get
Try
Return Me.FixedCColor
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Get
Set(ByVal Value As Color)
Try
Me.FixedCColor = Value
Me.ADONISFlexGrid.BackColorFixed = Me.FixedCColor
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Set
End Property
Public Property SelectedRowColor() As Color
Get
Try
Return Me.HighlightColor
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Get
Set(ByVal Value As Color)
Try
Me.HighlightColor = Value
Me.ADONISFlexGrid.BackColorSel = Me.HighlightColor
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Set
End Property
Public Property AllowUserResizingGrid() As MSFlexGridLib.AllowUserResizeSettings
Get
Try
Return Me.UserResizing
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Get
Set(ByVal Value As MSFlexGridLib.AllowUserResizeSettings)
Try
Me.UserResizing = Value
Me.ADONISFlexGrid.AllowUserResizing = Me.UserResizing
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Set
End Property
Public Property CustomeAppearance() As MSFlexGridLib.AppearanceSettings
Get
Try
Return Me.GridApperance
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Get
Set(ByVal Value As MSFlexGridLib.AppearanceSettings)
Try
Me.GridApperance = Value
Me.ADONISFlexGrid.Appearance = Me.GridApperance
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Set
End Property
Public Property HighlightStyle() As MSFlexGridLib.HighLightSettings
Get
Try
Return Me.HighLight
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Get
Set(ByVal Value As MSFlexGridLib.HighLightSettings)
Try
Me.HighLight = Value
Me.ADONISFlexGrid.HighLight = Me.HighLight
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Set
End Property
Public Property ScrollBarStyle() As MSFlexGridLib.ScrollBarsSettings
Get
Try
Return Me.GridScrollBar
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Get
Set(ByVal Value As MSFlexGridLib.ScrollBarsSettings)
Try
Me.GridScrollBar = Value
Me.ADONISFlexGrid.ScrollBars = Me.GridScrollBar
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Set
End Property
Public Property SelectionMode() As MSFlexGridLib.SelectionModeSettings
Get
Try
Return Me.GridSection
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Get
Set(ByVal Value As MSFlexGridLib.SelectionModeSettings)
Try
Me.GridSection = Value
Me.ADONISFlexGrid.SelectionMode = Me.GridSection
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Set
End Property
Public Property PictureTypeSettings() As MSFlexGridLib.PictureTypeSettings
Get
Try
Return Me.GridPicture
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Get
Set(ByVal Value As MSFlexGridLib.PictureTypeSettings)
Try
Me.GridPicture = Value
Me.ADONISFlexGrid.PictureType = Me.GridPicture
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Set
End Property
Public Property GridHeading() As String
Get
Try
Return Me.GridForMatString
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Get
Set(ByVal Value As String)
Try
Me.GridForMatString = Value
Me.ADONISFlexGrid.FormatString = Me.GridForMatString
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Set
End Property
#End Region
#Region "Public Grid Function"
Public Function SetColWidth(ByVal ColumnIndex As Integer, ByVal ColumnWidth As Integer) As Integer
Try
Me.ADONISFlexGrid.set_ColWidth(ColumnIndex, ColumnWidth)
Return SetColWidth
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Function
Public Function ColumnHeadingAlignment(ByVal ColumnIndex As Integer, ByVal AlignmentIndex As Short) As Integer
Try
Me.ADONISFlexGrid.set_FixedAlignment(ColumnIndex, AlignmentIndex)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Function
#End Region
#Region "Grid Event"
Private Sub CustomiseFlexGrid_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
Me.ADONISFlexGrid.set_ColWidth(0, 500)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
#End Region
______________________________________________
#Region "Private Variable for TextBox"
Private TxtVixible As Boolean
Private TxtEnabled As Boolean
Private TxtMaxLen As Integer
Private TxtToolTips As String
Private TxtReadOnly As Boolean
Private TxtForeColor As Color
Private TxtBackColor As Color
Private TxtFont As Font
Private TxtFontDialog As FontDialog
Private TxtCharFormat As CharacterCasing
Private TxtPassChar As Char
#End Region
#Region "Public Property for TextBox"
Public Property VisibleTextBox() As Boolean
Get
Try
Return Me.TxtVixible
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Get
Set(ByVal Value As Boolean)
Try
Me.TxtVixible = False
Me.TextBox1.Visible = Me.TxtVixible
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Set
End Property
Public Property EnabledTextBox() As Boolean
Get
Try
Return Me.TxtEnabled
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Get
Set(ByVal Value As Boolean)
Try
Me.TxtEnabled = Value
Me.ADONISFlexGrid.Enabled = Me.TxtEnabled
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Set
End Property
Public Property TextBoxMaxLength() As Integer
Get
Try
Return Me.TxtMaxLen
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Get
Set(ByVal Value As Integer)
Try
Me.TxtMaxLen = Value
Me.TextBox1.MaxLength = Me.TxtMaxLen
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Set
End Property
Public Property TxtBoxToolTips() As String
Get
Try
Return Me.TxtToolTips
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Get
Set(ByVal Value As String)
Try
Me.TxtBoxToolTips = Value
Me.ToolTip1.SetToolTip(Me.TextBox1, Me.TxtToolTips)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Set
End Property
Public Property TextBoxReadOnly() As Boolean
Get
Try
Return Me.TxtReadOnly
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Get
Set(ByVal Value As Boolean)
Try
Me.TxtReadOnly = Value
Me.TextBox1.ReadOnly = Me.TxtReadOnly
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Set
End Property
Public Property TextBoxForeColor() As Color
Get
Try
Return Me.TxtForeColor
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Get
Set(ByVal Value As Color)
Try
Me.TxtForeColor = Value
Me.TextBox1.ForeColor = Me.TxtForeColor
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Set
End Property
Public Property TextBoxBackColor() As Color
Get
Try
Return Me.TxtBackColor
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Get
Set(ByVal Value As Color)
Try
Me.TxtBackColor = Value
Me.TextBox1.BackColor = Me.TxtBackColor
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Set
End Property
Public Property TextBoxFont() As FontDialog
Get
Try
Return Me.TxtFontDialog
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Get
Set(ByVal Value As FontDialog)
Try
Me.TxtFontDialog = New FontDialog
Me.TxtFontDialog = Value
If Me.TxtFontDialog.ShowDialog = DialogResult.OK Then
Me.TextBox1.Font = Me.TxtFontDialog.Font
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Set
End Property
Public Property TxtCharCasing() As CharacterCasing
Get
Try
Return Me.TxtCharCasing
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Get
Set(ByVal Value As CharacterCasing)
Try
Me.TxtCharCasing = Value
Me.TextBox1.CharacterCasing = Me.TxtCharCasing
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Set
End Property
Public Property TextBoxPWD() As Char
Get
Try
Return Me.TxtPassChar
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Get
Set(ByVal Value As Char)
Try
Me.TxtPassChar = Value
Me.TextBox1.PasswordChar = Me.TxtPassChar
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Set
End Property
#End Region
#Region "Public Function For TextBox"
Public Function SetTextBoxFont(ByVal FontName As String, ByVal FontSize As Single, ByVal CustomeFontStyle As System.Drawing.FontStyle) As System.Drawing.Font
Try
Me.TextBox1.Font = New Font(FontName, FontSize, CustomeFontStyle)
Return SetTextBoxFont
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Function
#End Region
#Region "Public Event for TextBox"
#End Region
Thanks in Advance
Sibaji