G
Guest
Hi,
I am trying to pass the name of a grid I create in a form through to the grid control class I have created. I am doing this so that I can setup the grid according to the settings I store in a database. The grid I created inherits the Datagrid. I tried mybase.name but that doesn't work I just get an empty string back. My second Idea was to include an optional variable in the constructor. Just running the code this works however I do get an error message saying:
'Public Sub New([Name As String = ""])' and 'Public Sub New()' cannot overload each other because they differ only by optional parameters.
The code I am using is down here:
Option Strict Off
Option Explicit On
Imports Microsoft.VisualBasic
Imports System
Imports System.Data
Imports System.Drawing
Imports System.Windows.Forms
Public Class DGrid
Inherits DataGrid
#Region " Windows Form Designer generated code "
Public Sub New(Optional ByVal Name As String = "")
MyBase.New()
If Not Name = "" Then Me.Name = Name
'This call is required by the Windows Form Designer.
InitializeComponent()
MsgBox(Name)
LoadDataset()
'setColumns()
'Add any initialization after the InitializeComponent() call
End Sub
Any suggestion please...
please keep it simple as I am still to be considered a newbie ))
Thanks
David J
I am trying to pass the name of a grid I create in a form through to the grid control class I have created. I am doing this so that I can setup the grid according to the settings I store in a database. The grid I created inherits the Datagrid. I tried mybase.name but that doesn't work I just get an empty string back. My second Idea was to include an optional variable in the constructor. Just running the code this works however I do get an error message saying:
'Public Sub New([Name As String = ""])' and 'Public Sub New()' cannot overload each other because they differ only by optional parameters.
The code I am using is down here:
Option Strict Off
Option Explicit On
Imports Microsoft.VisualBasic
Imports System
Imports System.Data
Imports System.Drawing
Imports System.Windows.Forms
Public Class DGrid
Inherits DataGrid
#Region " Windows Form Designer generated code "
Public Sub New(Optional ByVal Name As String = "")
MyBase.New()
If Not Name = "" Then Me.Name = Name
'This call is required by the Windows Form Designer.
InitializeComponent()
MsgBox(Name)
LoadDataset()
'setColumns()
'Add any initialization after the InitializeComponent() call
End Sub
Any suggestion please...
please keep it simple as I am still to be considered a newbie ))
Thanks
David J