views:

28

answers:

3

Function:

Public Shared Function ConvertoDate(ByVal dateString As String, ByRef result As DateTime) As Boolean
        Try
            Dim supportedFormats() As String = New String() {"MM/dd/yyyy"}
            result = DateTime.ParseExact(dateString, supportedFormats, System.Globalization.CultureInfo.CurrentCulture, System.Globalization.DateTimeStyles.None)
            Return True
        Catch ex As Exception
            Return False
        End Try
    End Function

Date String

Dim FlightDateArriveString As String = (FlightMonthArrive.SelectedValue.ToString & "/" & FlightDayArrive.SelectedValue.ToString & "/" & "2010")

*ConvertoDate(FlightDateArriveString)*

The error message is given by the line above ^ and says:

"Arguement not specified for parameter result of public shared function ConvertoDate (datestring as String, ByRef result as date) as Boolean"

A: 

Where are you putting the result? Your ConvertToDate takes two paramaters: the string to convert, a DateTime reference to place the converted value and returns a boolean to indicate whether it was successful.

ChrisBD
A: 

You need to pass a second parameter to the ConvertoDate function

Dim MyResult as DateTime
ConvertoDate(FlightDateArriveString, MyResult)
geoff
A: 

You need to declare a variable to hold the result:

Dim result As DateTime
ConvertoDate(FlightDateArriveString, result)
Darin Dimitrov