Double dot notation is it possible in VB.NET

matt_1ca , notation , doubledot Calgary, Canada
  • 11 years ago
    I am trying to have a firm grasp of VB.NET and wondering if there is a way to use a double dot notation instead of the single dot notation people are normally accustomed to? 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) 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

Post a reply

No one has replied yet! Why not be the first?

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“The greatest performance improvement of all is when a system goes from not-working to working.” - John Ousterhout