SP - Thanks for the feedback. You are on-track with my issue except the
fact that my grid is unbound. Here's what I basically do. Load a dataset,
add this info to a temp dataset, load info from another dataset and then
merge the data into one dataset. I then loop through the rows and and
manually populate my grid, adding in grid rows where needed for the
calculations. Here is kind of the way that I load everything up...
For Each item As String In My.Forms.AircraftSelector.names
Me.TblAircraftSpecificTableAdapter.FillByAircraftModel(Me.LEADDataSet.tblAircraftSpecific,
item.ToString)
ds.Merge(LEADDataSet)
Next item
LEADDataSet.Merge(ds)
For r = 0 To Me.LEADDataSet.tblAircraftSpecific.Rows.Count - 1
intAircraftID =
CInt(Me.LEADDataSet.tblAircraftSpecific.Rows(r)("IDAircraftSpecific").ToString)
Me.TblModificationTableAdapter.FillBy(Me.LEADDataSet.tblModification,
intAircraftID)
Me.TblAircraftInspectionTableAdapter.FillBy(Me.LEADDataSet.tblAircraftInspection,
intAircraftID)
intRunMods = Me.LEADDataSet.tblModification.Rows.Count
If intRunMods > intKeepMods Then intKeepMods = intRunMods
intRunInsp = Me.LEADDataSet.tblAircraftInspection.Rows.Count
If intRunInsp > intKeepInsp Then intKeepInsp = intRunInsp
Next
'Then I begin to load the grid...
For i = 0 To intRows
Me.TblAPUTableAdapter.FillBy(Me.LEADDataSet.tblAPU, CInt(GetAircraft(i,
"APUID", True)))
Me.TblEngineModelTableAdapter.FillBy(Me.LEADDataSet.tblEngineModel,
CInt(GetAircraft(i, "EngineID", True)))
Me.TblAircraftCategoryTableAdapter.FillBy(Me.LEADDataSet.tblAircraftCategory,
CInt(GetAircraft(i, "CategoryID", True)))
Me.TblGlobalVariablesTableAdapter.Fill(Me.GlobalVariablesDataSet.tblGlobalVariables)
blnHasAPU = HasAPU() 'Check for an AircraftSpecific APU
blnHasEngine = HasEngine() 'Check for an AircraftSpecific Engine
flxRow = 1
strManMod = GetAircraft(i, "AircraftManufacturer") & " " & GetAircraft(i,
"AircraftModel")
Me.txtStatus.Text = "Loading " & strManMod
Me.flxAllData.SetData(flxRow, j, strManMod)
Me.flxAllData.SetData(flxRow, 0, "Liability Insurance")
'Me.flxAllData.Rows(k).Style = styCurrency
Me.flxAllData.Rows(flxRow).AllowEditing = True
Me.flxAllData.SetData(flxRow, flxClmn,
CDec(GetAircraftCategory("LiabilityInsurance", True)))
rLiabilityInsurance = flxRow
flxRow += 1
Me.flxAllData.SetData(flxRow, 0, "Number of Pilots")
'Me.flxAllData.Rows(k).Style = styNumber
Me.flxAllData.Rows(flxRow).AllowEditing = True
Me.flxAllData.SetData(flxRow, flxClmn,
CInt(GetAircraftCategory("CrewNumber", True)))
rCrewNumber = flxRow
flxRow += 1
'END OF Sample
flxAllData is the Grid and GetAircraftCategory is simply a function to
return the value from the dataset specific row.
Now, when it comes to calculations, I have to reference the row and column
to get each values I want to use in my calculation.
Another thing I want to do is to set up the loading of all the data and
calculations over to another thread and then display the data to the grid.
I will look more at the collection class but thought I had eliminated it for
one reason or another.
Regards,
Brian
>>I load a bunch of data from a dataset (about 10 rows with 125 columns) and
>>with the dataset rows, I perform a bunch (about 75) of calculations. The
[quoted text clipped - 47 lines]
>
> SP
SP - 20 Feb 2006 04:39 GMT
> SP - Thanks for the feedback. You are on-track with my issue except the
> fact that my grid is unbound. Here's what I basically do. Load a
[quoted text clipped - 77 lines]
> Regards,
> Brian
When I look at the code example I see a need to separate out your business
objects, the database interaction, and the presentation. I have never been a
fan of datasets and perhaps moving away from them will then allow you to
build an object model that represents the relationships between the various
business objects. Then the lookup / functions that you are calling as you
load the grid can be encapsulated within your business objects. Then your
loading of the grid could be more like (my VB is a little rusty!!)
For Each Aircraft aircraft In Aircrafts
Me.flxAllData.SetData(flxRow, 0, aircraft.Manufacturer)
Me.flxAllData.SetData(flxRow, 1, aircraft.Model")
End For
Having a business object model allows you to get to the information you need
by navigating from object to object like aircraft.Manufacturer.Models.Count.
So given an aircraft you can easily get to the number of different aircraft
manufacturered by the maker of that aircraft.
HTH
SP
Brian P. Hammer - 20 Feb 2006 05:12 GMT
Thanks for the feedback. I'll do some reading into business objects. What
you say makes sense.
>> SP - Thanks for the feedback. You are on-track with my issue except the
>> fact that my grid is unbound. Here's what I basically do. Load a
[quoted text clipped - 101 lines]
>
> SP