Code problem

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
 
M

Marina

You need to declare optional parameters this way: Optional sortBy As String
= "PatientID"
 
K

Kevin Spencer

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top