467,081 Members | 1,135 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,081 developers. It's quick & easy.

1:N getChildRows ?

I'm really lost right now, I can't figure out how to pass to values from a table back to the presentationTier. I am searching by the value selected in the parent(carSize) using a comboBox and passing the selected value to the dataTier to select the childRows(manufactuer and model). The child values will be set into a dataGrid. Here is my code, any advice would be greatly appreciated! Should I just return the dataSet instead of doing it this way and then setup everything in the presentation? Thank you

Expand|Select|Wrap|Line Numbers
  1.   Public Function getCarSize(ByVal carSize_String As String) As String
  2.         Dim drCarSize As DataRow
  3.         Dim drVehicles As DataRow()
  4.         Dim manufacturerString As String
  5.         Dim manufModelStrings(10) As String
  6.         Dim modelString As String
  7.         Dim modelStrings(10) As String
  8.         Dim subInt As Integer
  10.         drCarSize = aCustomerDataSet.CarSize.FindBySizeCode(carSize_String)
  12.         drVehicles = drCarSize.GetChildRows("CarsToVehicleRelation")
  14.         For Each drVehicle As DataRow In drVehicles
  15.             manufacturerString = drVehicle.GetParentRow("CarsToVehicleRelation")!manuf_name.ToString
  16.             modelString = drVehicle.GetParentRow("CarsToVehicleRelation")!model.ToString
  18.             manufacturerStrings(subInt) = manufacturerString
  19.             modelStrings(subInt) = modelString
  21.             subInt += 1
  22.         Next
  23.         Return ' what?
  24.     End Function
Nov 2 '06 #1
  • viewed: 1253
1 Reply
Expert 8TB
I can't advise on what is a good way to go about it, but I'd like to point out that you can in fact modify the "input" parameters in a function, unless they are passed ByVal. So in theory, you could include output parameters inside the parentheses, and return values in them.

In other words, you can do something like:
Expand|Select|Wrap|Line Numbers
  1. Public Function DoSomething(In1, In2, Out1, Out2, Out3) As Long
And of course, depending on how it is to be used and what you want from it, you could then make it a Sub rather than a Function.

As to whether this is an acceptable practise, that's your call.
Nov 2 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

7 posts views Thread by Ben R. | last post: by
9 posts views Thread by Christopher Weaver | last post: by
3 posts views Thread by I am Sam | last post: by
8 posts views Thread by I am Sam | last post: by
5 posts views Thread by Geoff Jones | last post: by
2 posts views Thread by Joe | last post: by
2 posts views Thread by G .Net | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.