473,804 Members | 2,195 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Valu e + 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(ByVa l 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.Recor dSID) ' Note: FIELDS.RecrodSI D is the table
index
' Or, for those of you who are lost because of the default property:
' Return Me.FieldValue(F IELDS.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.Val ue

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

Help!

Thanks,
Joe
Oct 26 '05 #1
0 1308

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

Similar topics

15
2291
by: Ville Vainio | last post by:
Pythonic Nirvana - towards a true Object Oriented Environment ============================================================= IPython (by Francois Pinard) recently (next release - changes are still in CVS) got the basic abilities of a system shell (like bash). Actually, using it as a shell is rather comfortable. This all made me think... Why do we write simple scripts to do simple things? Why do we serialize data to flat text files in...
3
6558
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") but it doesn't work, there is no error message, the page just displays nothing. I tried various commands like "mkdir test" or calling a batch
7
2679
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 webbrowser. Does anyone know how to create a shell object in an ASP? Thanks,
11
9281
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 C++. I find my self sometimes, trying Object app = Object(); Object *app = Object(); Object app = new Object();
1
1135
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 object, load it with a stylesheet file or some text, and return this object. public XslTransform Create() { XslTransform xslt = new XslTransform(); xslt.Load("style.xsl"); //or load with some built-in stylesheet text return xslt; }
9
10912
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 the wheel, right? Everything so far is working well with the Active Directory. The problem I am having is with adding File Permissions to a directory. I am currently using some code courtesy of "Willy Denoyette "
2
19282
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 folder.However if I am runing the file local it will work Any reason, why when the file is in the web server folder the create object failed to created the shell object. Systax:
0
235
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 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 =...
4
6574
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: assignment makes integer from pointer without a cast fork.c:61: warning: comparison between pointer and integer /tmp/cciECfg4.o: In function `main': fork.c:(.text+0x3a): warning: the `gets' function is dangerous and should not be used. #include...
0
9715
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9595
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10600
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9175
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6867
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5535
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3835
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3002
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.