Code problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am having a problem with my subroutine "doBinding". I have set the default
sortBy to the "PatientID" field from my datasource. However, I am getting
build errors on the "PatientID" field. Why is this invalid?

Sub doBinding( optional sortBy As String "PatientID")
Dim pat As New PatientDP
dsPatient = pat.GetPatientList()
DataGrid1.DataSource = dsPatient.tblPatient
DataGrid1.DataBind()
End Sub

Sub reSort(ByVal s As Object, ByVal e As DataGridSortCommandEventArgs)
doBinding(e.sortExpression)
End Sub
 
You need to declare optional parameters this way: Optional sortBy As String
= "PatientID"
 
Sub doBinding( optional sortBy As String = "PatientID")

You probably just need to clean your glasses!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Ambiguity has a certain quality to it.
 
Back
Top