ACAE
asked on
Ancestor datagrid problem
Hello,
I have created a datagrid that inherits from DataGrid:
Public Class YnpDataGrid
Inherits DataGrid
I'm having strange problems with this ancestor; when I try to open it in the designer, it doesn't display my class but shows a form with the error 'The variable 'ex' is either undeclared or was never assigned'
I have checked my code, and I only use the 'ex' variable in the 'Try' functions:
Try
... some code
Catch ex As Exception
MsgBox(ex.Message)
End Try
This seems to be a very stupid error, but then, vb.net 2005 is the worst development language I have ever encountered (and I have encountered a lot of them).
Anyone knows how to solve this ? I can of course remove the 'try' functions, but then my program could crash without me knowing what is going on.
Thx for your help
I have created a datagrid that inherits from DataGrid:
Public Class YnpDataGrid
Inherits DataGrid
I'm having strange problems with this ancestor; when I try to open it in the designer, it doesn't display my class but shows a form with the error 'The variable 'ex' is either undeclared or was never assigned'
I have checked my code, and I only use the 'ex' variable in the 'Try' functions:
Try
... some code
Catch ex As Exception
MsgBox(ex.Message)
End Try
This seems to be a very stupid error, but then, vb.net 2005 is the worst development language I have ever encountered (and I have encountered a lot of them).
Anyone knows how to solve this ? I can of course remove the 'try' functions, but then my program could crash without me knowing what is going on.
Thx for your help
ASKER
I have tried
Try
If not me.designmode = true
... some code
end if
Catch ex As Exception
MsgBox(ex.Message)
End Try
and
If not me.designmode = true
Try
... some code
Catch ex As Exception
MsgBox(ex.Message)
End Try
end if
And I still have teh same error
Try
If not me.designmode = true
... some code
end if
Catch ex As Exception
MsgBox(ex.Message)
End Try
and
If not me.designmode = true
Try
... some code
Catch ex As Exception
MsgBox(ex.Message)
End Try
end if
And I still have teh same error
What have you added in New()
ASKER
Public Sub New()
MyBase.New()
'This call is required by the Component Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
Private Sub InitializeComponent()
If Not Me.DesignMode = True Then
'Try
Me.cmDataGrid = New System.Windows.Forms.Conte
CType(Me, System.ComponentModel.ISup
'
'YnpDataGrid
'
Me.ContextMenu = Me.cmDataGrid
CType(Me, System.ComponentModel.ISup
miColumns = New MenuItem
cmDataGrid.MenuItems.AddRa
miColumns.DefaultItem = True
miColumns.Index = 0
miColumns.Text = "Columns"
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
This works, thank you very much for your help
If not me.designmode = true
... some code
end if
Catch ex As Exception
MsgBox(ex.Message)
End Try