473,394 Members | 1,916 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Code problem

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
Nov 19 '05 #1
2 930
You need to declare optional parameters this way: Optional sortBy As String
= "PatientID"

"JackO" <Ja***@discussions.microsoft.com> wrote in message
news:63**********************************@microsof t.com...
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

Nov 19 '05 #2
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.

"JackO" <Ja***@discussions.microsoft.com> wrote in message
news:63**********************************@microsof t.com...
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

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

51
by: Mudge | last post by:
Please, someone, tell me why OO in PHP is better than procedural.
242
by: James Cameron | last post by:
Hi I'm developing a program and the client is worried about future reuse of the code. Say 5, 10, 15 years down the road. This will be a major factor in selecting the development language. Any...
53
by: Cardman | last post by:
Greetings, I am trying to solve a problem that has been inflicting my self created Order Forms for a long time, where the problem is that as I cannot reproduce this error myself, then it is...
67
by: Steven T. Hatton | last post by:
Some people have suggested the desire for code completion and refined edit-time error detection are an indication of incompetence on the part of the programmer who wants such features. ...
8
by: Paul Cochrane | last post by:
Hi all, I've got an application that I'm writing that autogenerates python code which I then execute with exec(). I know that this is not the best way to run things, and I'm not 100% sure as to...
8
by: Steve Jorgensen | last post by:
Hi folks, I'm posting this message because it's an issue I come up against relatively often, but I can't find any writings on the subject, and I haven't been able to figure out even what key...
2
by: Praveen K | last post by:
I have a problem in communicating between the C# and the Excel Interop objects. The problem is something as described below. I use Microsoft Office-XP PIA dll’s as these dll’s were been...
6
by: TPJ | last post by:
Help me please, because I really don't get it. I think it's some stupid mistake I make, but I just can't find it. I have been thinking about it for three days so far and I still haven't found any...
16
by: Rex | last post by:
Hi All - I have a question that I think MIGHT be of interest to a number of us developers. I am somewhat new to VIsual Studio 2005 but not new to VB. I am looking for ideas about quick and...
8
by: Andy B | last post by:
Before I do a no no on a newsgroup, I need to ask a question: What is the max number of lines of code you can/should post here before it gets too long?
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.