472,980 Members | 2,097 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Passing Datasets as Object - Strict On - How get type?

I'm relatively new to .Net, and would appreciate a little assistance.

I have multiple datasets attached to individual grids on individual tabs on
a form.

I would like to have a series of generic functions such as SaveChange,
RejectChanges, passing a grid and related dataset. As the datasets are
different types, I'm passing them as an object. I dont wish to override the
function with multiple copies and duplicated code.

However, Option Strict On, disallows late binding.

I've tried ds.gettype and passing the ds type, but cant figure it out.

Pseudo code

if tabName = "A" then
SaveChanges( gridA, dsA)
elseif tabName = "B" then
SaveChanges( gridB, dsB)
' many more
end if
Sub SaveChanges( ByVal grid as Infragistics.Win.UltraWinGrid.UltraGrid,
ByVal ds As Object )

' Code removed

if ds.haschanges then
ds.update
end if

end sub

------
Thanks in advance for any help.
Nov 20 '05 #1
4 2939
Cor
Hi Gr8north,

Why do you need that grid when you are updating the dataset.

In my opinion you can better think from your source (the dataset) than from
your view (the datagrid).

I myself give a lot of things to routines which are the same as you made
(even the command to get easy parameter handling) but not the datagrid.

I have never had any problems with late binding in that.
(Although when it was, it would not be a problem for me, but that is not
what I mean with that sentence)

Cor
Nov 20 '05 #2
Remember, a typed dataset inherits from System.Data.Dataset, so you don't
need to pass it as object.

Second, Option Strict does not disallow late binding, it requires strong
typecasting at design time.

i.e.

Option Strict Off

Public class myclass

private i as integer
private d as decimal

public sub go()

d= 10.3
i = d
''' results in i = 10
end sub
end class

where with option strict on... doing the same thing would cause a compile
error. because you would need to do a

i = ctype(d, integer)

I don't know if tihs will work off the fly, I'm just typing it in here.. but
hopefully you get the point...

-CJ
"Gr8North" <ae******@mad.com> wrote in message
news:uc**************@TK2MSFTNGP12.phx.gbl...
I'm relatively new to .Net, and would appreciate a little assistance.

I have multiple datasets attached to individual grids on individual tabs on a form.

I would like to have a series of generic functions such as SaveChange,
RejectChanges, passing a grid and related dataset. As the datasets are
different types, I'm passing them as an object. I dont wish to override the function with multiple copies and duplicated code.

However, Option Strict On, disallows late binding.

I've tried ds.gettype and passing the ds type, but cant figure it out.

Pseudo code

if tabName = "A" then
SaveChanges( gridA, dsA)
elseif tabName = "B" then
SaveChanges( gridB, dsB)
' many more
end if
Sub SaveChanges( ByVal grid as Infragistics.Win.UltraWinGrid.UltraGrid,
ByVal ds As Object )

' Code removed

if ds.haschanges then
ds.update
end if

end sub

------
Thanks in advance for any help.

Nov 20 '05 #3
Resolved this.

Just passed as type Dataset instead of object.
"Gr8North" <ae******@mad.com> wrote in message
news:uc**************@TK2MSFTNGP12.phx.gbl...
I'm relatively new to .Net, and would appreciate a little assistance.

I have multiple datasets attached to individual grids on individual tabs on a form.

I would like to have a series of generic functions such as SaveChange,
RejectChanges, passing a grid and related dataset. As the datasets are
different types, I'm passing them as an object. I dont wish to override the function with multiple copies and duplicated code.

However, Option Strict On, disallows late binding.

I've tried ds.gettype and passing the ds type, but cant figure it out.

Pseudo code

if tabName = "A" then
SaveChanges( gridA, dsA)
elseif tabName = "B" then
SaveChanges( gridB, dsB)
' many more
end if
Sub SaveChanges( ByVal grid as Infragistics.Win.UltraWinGrid.UltraGrid,
ByVal ds As Object )

' Code removed

if ds.haschanges then
ds.update
end if

end sub

------
Thanks in advance for any help.

Nov 20 '05 #4
Cor
Hi CJ,

Did not see it, but here it has been dinnertime maybe that is the reason.

(It is not, I can tell you, just my stupidity not to see it)

:-)

Cor
Nov 20 '05 #5

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

Similar topics

20
by: Glenn Venzke | last post by:
I'm writing a class with a method that will accept 1 of 3 items listed in an enum. Is it possible to pass the item name without the enum name in your calling statement? EXAMPLE: public enum...
3
by: Simon Harvey | last post by:
Hi, In my application I get lots of different sorts of information from databases. As such, a lot of information is stored in DataSets and DataTable objects. Up until now, I have been passing...
4
by: Sahil Malik [MVP] | last post by:
Okay so now I understand (surprised though) - that WebServices can indeed pass ByRef/ref parameters. All I have to do is mark an integer parameter of a WebMethod as "ref". Funnily enough, this is...
25
by: Stuart Hilditch | last post by:
Hi all, I am hoping that someone with some experience developing nTier apps can give me some advice here. I am writing an nTier web app that began with a Data Access Layer (DAL), Business...
3
by: Rich | last post by:
Hello, I am converting an app from VB6 to VB.Net and have encountered the following problem. I have the following loop which retrieves objects from a collection of objects. Dim entry As...
1
by: Larry Bird | last post by:
I want to pass a dataview to another subroutine. I've successfully created the datavew as follows: For Each CriteriaDetailRow In AlertData.AlertDS.Tables("EventCriteria").Rows Dim foundRows()...
22
by: Arne | last post by:
How do I pass a dataset to a webservices? I need to submit a shoppingcart from a pocket PC to a webservice. What is the right datatype? II have tried dataset as a datatype, but I can't get it to...
5
by: Ram | last post by:
Hi Friends I want to develope a custom control in .net which can be used with any project. I am writing a function in that class which I want to take any object as parameter. For that I have...
12
by: Noel | last post by:
Hello, I'm currently developing a web service that retrieves data from an employee table. I would like to send and retrieve a custom employee class to/from the webservice. I have currently coded...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.