Torna al Thread

Public Class MyUserControl Dim _myClass As MyClass Public Event Save(ByVal sender As MyUserControl) Sub New(ByVal myClass As MyClass) Me.InitializeComponent() _myClass = myClass End Sub Private Sub MyUserControl_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load tbCodice.Text = _myClass.Code tbDescription.Text = _myClass.Description End Sub Private Sub SaveClass() If Me.IsValideCode Then _myClass.Name = tbCode.Text _myClass.Description = tbSDescription.Text End Sub Private Sub btSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btSave.Click Me.SaveAgent() RaiseEvent Save(Me) End Sub #Region "Validazioni" Private Function IsValideCode() As Boolean Try If tbCode.Text = String.Empty Then Throw New Exception("Valore del campo 'Codice' obbligatorio") Else Return True End If Catch ex As Exception Throw ex End Try End Function #End Region End Class
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5