Karsittua koodia...
Public Class FormatableCodes_class Public Data As Data_class Public DefaultSetting() As String = ({"", "N", "3", "Y", "N", "4", "N", "5", "Y", "N", "3", "1", "1", "N", "0", "0"}) ' ' Dim NewRowControl As FormatableCodes_DataRow_uc 'usercontrol ' ' Public Sub AddNewRowToDataRowPanel(ByVal Keyword As String) NewRowControl = New FormatableCodes_DataRow_uc NewRowControl.Keyword = Keyword If Me.Data.Item(Keyword).Setting.Length < 1 Then Me.Data.Item(Keyword).Setting = DefaultSetting End If NewRowControl.Setting = Me.Data.Item(Keyword).Setting AddHandler NewRowControl.SettingChanged, AddressOf SettingChanged Me.DataRowPanel.Controls.Add(NewRowControl) End Sub ' ' Public Sub SettingChanged(ByVal Row As FormatableCodes_DataRow_uc) Me.Data.Item(Row.Keyword).Setting = Row.Setting End Sub ' ' End Class
Public Class FormatableCodes_DataRow_uc Public Event SettingChanged(ByVal Row As FormatableCodes_DataRow_uc) Public Setting() As String ' ' Sub Label_KeyPress(sender As Label, e As System.Windows.Forms.KeyPressEventArgs) Handles Label1.KeyPress, Label2.KeyPress, Label3.KeyPress ' ' Setting(CInt(Sender.tag)) = sender.Text RaiseEvent SettingChanged(Me) ' ' End Sub ' ' End Class
Miksiköhän DefaultSetting-taulukko muuttuu UserControlin Setting-taulukoksi juuri silloin kun usercontrolin SettingChanged-eventti laukaisee FormatableCodes-luokan SettingChanged aliohjelman... osaako kukaan arvata?
DefaultSetting-taulukkoa ei käytetä missään muualla kuin AddNewRowToDataRowPanel-aliohjelmassa.
Aihe on jo aika vanha, joten et voi enää vastata siihen.