scottsanpedro
Member
- Joined
- Jan 24, 2009
- Messages
- 21
- Programming Experience
- 1-3
Slightly confused on what is the best format of coding between Methods and properties.
Here is some code, a shared property that I use instead of using a method with one argument.
Is there any better way of doing this, or is this perfectly acceptable instead of using a method?
Many thanks
Here is some code, a shared property that I use instead of using a method with one argument.
VB.NET:
Public Shared WriteOnly Property GetComboList() As ComboBox
Set(ByVal _ComboBox As ComboBox)
Try
Dim td As New RAIDDataSetTableAdapters.COMBO_GET_VALUESTableAdapter
Dim dt As New RAIDDataSet.COMBO_GET_VALUESDataTable
td.Fill(dt, _ComboBox.Name.ToString)
_ComboBox.DisplayMember = dt.CB_ValueColumn.ToString
_ComboBox.ValueMember = dt.CB_ValueColumn.ToString
_ComboBox.DataSource = dt
Catch ex As Exception
MessageBox.Show("error found." & vbCrLf & ex.Message, clsGeneral.ConTitle, MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Set
End Property
Many thanks