Community
style="BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px">
<matt_1ca> wrote in messageI
href="news:6160785@discussion.autodesk.com">news:6160785@discussion.autodesk.com...
am wondering if there is a way to use a double dot notation instead of the
single dot notation people are normally accustomed to? Currently the company
bigwigs have decided that we will have to go with new AutoCAD program
developments using VB.net. Since all the people in our group are new in .NET
there has been a debate as to whether a double dot net call as shown below is
at all possible. On my side I have exhausted all the books in my arsenal but
cannot find a single example showing how to implement it. The double dot
notation that I want to implement is shown directly below:
PersonData.Birthdate.IsValid Currently, the only way I know is by using the
call shown below which I suspect is not using the full capabilities of .NET:
Validations.IsValid(PersonData.Birthdate) In other words what I want to do is
to somehow be able to replace the Validations.IsValid(PersonData.Birthdate)
with a PersonData.Birthdate.IsValid call. My gut feeling is that there is a
way to do it, and I am not about to give up unless experts out there like
yourselves tell me that it is not possible. Is it possible or not? If it is
possible, then what changes do I need to do in my code to make it happen?
Thank you so much, I appreciate all the kind help you could give on this
matter... Gratefully, Matt My code is shown below: Private Sub
Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click modVar.intDay = 25 modVar.intMonth = 12 modVar.intYear =
2009 Dim PersonData As New Person(modVar.intMonth, modVar.intDay,
modVar.intYear) Dim Validation As New Validations If
Validations.IsValid(PersonData.Birthdate) = True Then MsgBox("Valid date")
Else MsgBox("Date entered by user is invalid") End If End Sub Public Class
DateProcessing Public Function Birthdate() As String Birthdate =
CStr(intMonth) & "-" & CStr(intDay) & "-" & CStr(intYear) End
Function End Class Public Class Person Inherits DateProcessing Public Sub
New(ByVal intMonth As Integer, ByVal intDay As Integer, ByVal intyear As
Integer) intMonth = intMonth intDay = intDay intyear = intyear End Sub End
Class Public Class Validations Public Shared Function IsValid(ByVal
strDateOfBirth As String) As Boolean Dim varData As Object IsValid = True
varData = Split(strDateOfBirth, "-") If CStr(varData(0)).Length = 2 Then Else
IsValid = False Exit Function End If If CStr(varData(1)).Length = 2 Then Else
IsValid = False Exit Function End If If CStr(varData(2)).Length = 4 Then Else
IsValid = False Exit Function End If End Function End Class Module modVar
Public intYear As Integer Public intMonth As Integer Public intDay As Integer
End Module
style="BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px"
dir=ltr>
"Paul Richardson" <prichardson<lastpoint> wrote in message
href="news:6160791@discussion.autodesk.com">news:6160791@discussion.autodesk.com...
If you create a BirthDay type which has a Valid
method and this type is a field in your PersonData class you could call
it
like you want. IMO you usually don't want to
create an instance of a type if you have bad data. I would handle it
something
like the attached sample. Also you guys should
find a good newsgroup to ask these questions that don't involve the
Autocad
dot NET api. The sample is in c# but you should
get the idea.
style="BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px">
<matt_1ca> wrote in messageI
href="news:6160785@discussion.autodesk.com">news:6160785@discussion.autodesk.com...
am wondering if there is a way to use a double dot notation instead of the
single dot notation people are normally accustomed to? Currently the company
bigwigs have decided that we will have to go with new AutoCAD program
developments using VB.net. Since all the people in our group are new in .NET
there has been a debate as to whether a double dot net call as shown below
is at all possible. On my side I have exhausted all the books in my arsenal
but cannot find a single example showing how to implement it. The double dot
notation that I want to implement is shown directly below:
PersonData.Birthdate.IsValid Currently, the only way I know is by using the
call shown below which I suspect is not using the full capabilities of .NET:
Validations.IsValid(PersonData.Birthdate) In other words what I want to do
is to somehow be able to replace the
Validations.IsValid(PersonData.Birthdate) with a
PersonData.Birthdate.IsValid call. My gut feeling is that there is a way to
do it, and I am not about to give up unless experts out there like
yourselves tell me that it is not possible. Is it possible or not? If it is
possible, then what changes do I need to do in my code to make it happen?
Thank you so much, I appreciate all the kind help you could give on this
matter... Gratefully, Matt My code is shown below: Private Sub
Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click modVar.intDay = 25 modVar.intMonth = 12 modVar.intYear
= 2009 Dim PersonData As New Person(modVar.intMonth, modVar.intDay,
modVar.intYear) Dim Validation As New Validations If
Validations.IsValid(PersonData.Birthdate) = True Then MsgBox("Valid date")
Else MsgBox("Date entered by user is invalid") End If End Sub Public Class
DateProcessing Public Function Birthdate() As String Birthdate =
CStr(intMonth) & "-" & CStr(intDay) & "-" & CStr(intYear)
End Function End Class Public Class Person Inherits DateProcessing Public
Sub New(ByVal intMonth As Integer, ByVal intDay As Integer, ByVal intyear As
Integer) intMonth = intMonth intDay = intDay intyear = intyear End Sub End
Class Public Class Validations Public Shared Function IsValid(ByVal
strDateOfBirth As String) As Boolean Dim varData As Object IsValid = True
varData = Split(strDateOfBirth, "-") If CStr(varData(0)).Length = 2 Then
Else IsValid = False Exit Function End If If CStr(varData(1)).Length = 2
Then Else IsValid = False Exit Function End If If CStr(varData(2)).Length =
4 Then Else IsValid = False Exit Function End If End Function End Class
Module modVar Public intYear As Integer Public intMonth As Integer Public
intDay As Integer End Module
style="BORDER-LEFT: #000000 2px solid; PADDING-LEFT: 5px; PADDING-RIGHT: 0px; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px">
<matt_1ca> wrote in messageThank
href="news:6160906@discussion.autodesk.com">news:6160906@discussion.autodesk.com...
you so much for this valuable answer, I really appreciate it. Gratefully,
Matt