Is this function something that gets called over and over again with
slightly different phrasings? If so, it could be implemented as a static
(Shared keyword in VB.NET) method. This enters memory once and you never
instantiate the class. As an example, suppose we have an add method (yes, I
know this is not data driven):
'I realize this can overflow, it is just an example
Public Shared Function AddNumbers(ByVal a as integer, ByVal b As Integer) As
Integer
Return a + b
End Function
Now, I can call the class like so:
Dim c as Integer = MathLib.AddNumbers(a,b)
this is essentially a helper method.
Now, to the properties. Does a single row have meaning to your system, or
are you merely using it to help answer questions for other true objects? If
it has meaning, you should create properties and fill the object as an
object, as it IS an object.
For the most part, data rows represent an object, tangible or intangible. A
possible exception is enumeration type tables, but you generally do not grab
a single row at a time in these tables.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
http://gregorybeamer.spaces.live.com
*************************************************
Think outside of the box!
*************************************************
"shapper" <md*****@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
Hello,
I created a simple class as follows:
Public Class HelloWorld
Public Function SayMessage() As String
Return "Hello World!"
End Function
End Class
Usage:
Dim objHelloWorld As New HelloWorld()
MyLabel.Text = objHelloWorld.SayMessage()
Then I recreated the class using a property:
Public Class HelloWorld
Public ReadOnly Property Message() As String
Get
Return SayMessage()
End Get
End Property
Public Function SayMessage() As String
Return "Hello World!"
End Function
End Class
Usage:
Dim objHelloWorld As New HelloWorld()
MyLabel.Text = objHelloWorld.Message
Which appoach should I use or when to use which one?
Could you advice me on this?
Thanks,
Miguel