473,385 Members | 1,843 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,385 software developers and data experts.

Integer Object Shell

I am working on some VB dot net classes and am inheriting from a class that
has a method that returns a general object. My problem is, of course, is
when i want to return an integer using this method. Ok, so I create a class
to encapsulate the interger as an Object.

Now, my question is how can I now treat that object as an integer? I do not
want the user of my method to have to do this sort of thing:
dim intIntPlusOne as Integer = objInteger.Value + 1

I also wanted to at least provide a default property of the Object so that
object itself acts as an integer, but apparently I can't define a default
property without a parameter.

And of course, now I have to go back and create Object versions of all of my
integers just so they can be passed through this method as an Object. Is
there any better solution out there then the one I have come up with?
In case anyone is interested, here is the method I am working with:

' Note: dtRecord is of type DataTable
Default Public Property FieldValue(ByVal intField As Integer) As Object
Get
If dtRecord Is Nothing Then Return Nothing

Return dtRecord.Rows(0)(intField)
End Get
Set(ByVal Value As Object)
If dtRecord Is Nothing Then Return

dtRecord.Rows(0)(intField) = Value
End Set
End Property

This is a general property for returning a specific column of my DataTable.
Where I am running into problems is where the value of the DataTable column
is an integer.

To elaborate even further... here is a property in my inheriting class that
uses that default property:

ReadOnly Property RecordSID() As Integer
Get
Return Me(FIELDS.RecordSID) ' Note: FIELDS.RecrodSID is the table
index
' Or, for those of you who are lost because of the default property:
' Return Me.FieldValue(FIELDS.RecordSID)
End Get
End Property

See here how this returns an Integer but my general default property returns
an Object? In case you are wondering, I am doing things this way to keep my
common data interactions in an inheritable place.

And, using this method as an example, if I encapsulate the object, I am
trying to avoid this:
dim i as intRecordSID = o.RecordSID.Value

when it currently would be done like this:
dim i as intRecordSID = o.RecordSID

Help!

Thanks,
Joe
Oct 26 '05 #1
0 1278

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

Similar topics

15
by: Ville Vainio | last post by:
Pythonic Nirvana - towards a true Object Oriented Environment ============================================================= IPython (by Francois Pinard) recently (next release - changes are...
3
by: Nico | last post by:
I try to execute a shell command from ASP with: response.write("start") Set wshShell = CreateObject("WScript.Shell") wshShell.Run "notepad" Set wshShell = Nothing response.write("finished") ...
7
by: Oliver Gräser | last post by:
Hej, I want to run batchfiles via the Shell, but accessible in the Browser via IIS. Actually, I'd like the server to start a command line ntbackup if a users selects to do so on an ASP in his...
11
by: DrUg13 | last post by:
In java, this seems so easy. You need a new object Object test = new Object() gives me exactly what I want. could someone please help me understand the different ways to do the same thing in...
1
by: shell shell via .NET 247 | last post by:
How do you get the underlying Xslt stylesheet content from an XslTransform object that has been created and loaded with a stylesheet file or some text? Assume a method will create an XslTransform...
9
by: Ben Dewey | last post by:
Project: ---------------------------- I am creating a HTTPS File Transfer App using ASP.NET and C#. I am utilizing ActiveDirectory and windows security to manage the permissions. Why reinvent...
2
by: Mike John | last post by:
I am trying to use the shell object to send keys to the explorer browser to run the send page funcion. I am receiving the above error only when I put my html file in the web server...
0
by: Joe Sullivan | last post by:
I am working on some VB dot net classes and am inheriting from a class that has a method that returns a general object. My problem is, of course, is when i want to return an integer using this...
4
by: metalinc | last post by:
hi...im new to C programming...need help...tried to run this code but got this error fork.c: In function ‘parse’: fork.c:44: warning: comparison between pointer and integer fork.c:51: warning:...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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...

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.