|
And now for a tutorial?
I would like to know too!
|
|
|
|
|
I'd like to be able to let my clients write code through code provider, such as
Dim Diff = Close - Open
...where Diff, Close, open are actuallyi double Arrays()
I see I can do it by overloading the - operator, but only if either Close or Open are new types. But I don't want to have to create a new type -- I just want to use plain old Close()as double and Open() as double in the syntax.
Is there anyway around this? Why does the operator overloading require a new type?
Thanks!
|
|
|
|
|
cstrader232 wrote: Is there anyway around this?
No.
cstrader232 wrote: Why does the operator overloading require a new type?
Because you can't modify the behavior of the System.Array class. You can only modify the behavior of a class you create FROM the Array class, which, won't be usable in the manner you want because that will ALWAYS use the System.Array class.
You simply cannot do what you want without requiring the user to use your custom type.
|
|
|
|
|
OK, fair enough... just wanted to be sure. Thanks and Happy weekend!
|
|
|
|
|
Dave Kreskowiak wrote: Because you can't modify the behavior of the System.Array class. You can only modify the behavior of a class you create FROM the Array class,
Can't you add code to existing classes in 3.5 now ? Or am I thinking of Objective C ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Christian Graus wrote: Can't you add code to existing classes in 3.5 now ? Or am I thinking of Objective C ?
Not that I know of, or heard of anyway. Maybe in C# it's possible?
|
|
|
|
|
I guess the most likely thing is that I'm thinking of something I read in an OC book....
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
If it was C#, you could make a wrapper type for an array, and implement an implicit conversion from you type to an array, to let the clients assign your type to an array variable and get the array instead.
Sadly, VB.NET doesn't support implicit conversions.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi all.
I have created a website that will be used internally. I want to create a web form in vb so scroll bars and menu's are gone and the site will load in a clean window.
I have created this form and when i load it up and click on a button (a JAVASCRIPT button) it comes up with the following error
'A runtime error has occured, do you wish to debug?
Line:35
Error: parent.frames.2 is null or not an object.
I have added the site to a server using IIS and it works throught internet explorer but i cannot get it to work with the vb form. I am pretty sure it's something to do with the buttons in my script as the message comes up whenever you click on one.
Any help would be appreciated.
David
|
|
|
|
|
Wat do you mean by VB form, you have a browser control in a VB program ?
Christian Graus
Please read this if you don't understand the answer I've given you
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Hi,
I wanna to get hard disk serial number i m using this code it work well in my pc but in client pc it doesn't give hdd serial no i don't know that
given number belogs to which physical media?
<br />
Dim mgmtobj As New ManagementObject<br />
Dim searcher As ManagementObjectSearcher<br />
<br />
searcher = New ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia")<br />
<br />
For Each mgmtobj In searcher.Get<br />
If mgmtobj("SerialNumber") = Nothing Then<br />
serial = ""<br />
Else<br />
serial = mgmtobj("SerialNumber").ToString.Trim<br />
End If<br />
Next<br />
Really its very urgent for me now
Thanks
The Great Pleasure In Doing That Things That Other People Say U Can't By Doing This U Can Shut Their Mouth
|
|
|
|
|
Please read the forum guidelines. Using 'urgent' in your message (or title) is frowned upon and my get you ignored completely.
|
|
|
|
|
I have this code in my library for getting the HDD serial number.
I know its not the best code - I cant remember where I got it from, but it does seem to work on the few machines I have tested it with:
Dim mobjSearcher As New ManagementObjectSearcher("SELECT * FROM Win32_LogicalDisk WHERE Name = 'C:'")
For Each obj As ManagementObject In mobjSearcher.Get
Return obj("VolumeSerialNumber").ToString
Next
Return "00000000000000"
Maybe it will work for you?
|
|
|
|
|
But - the obvious mistake you have made is...
If you find more than one drive in your search, and the SECOND drive doesnt have a serial number (for whatever reason), you are clearing the serial number...
Oops?
Thats the problems with for...next loops setting variables.
|
|
|
|
|
First of all thanks to all for reply
I know its not good to say "Urgent" but its really very very urgent for me so i had to wrote
Thanks Jasey9 for your code but....
<br />
Return obj("VolumeSerialNumber").ToString<br />
I have already tried it but it will return the volume number of a particular Drive like C: but after format the Pc it will change
so i need only the serial number of hard disk
Is there any way to varify that the number returned by searcher = New ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia")
is hard disk serial number,I need your guidance...
Thanks
The Great Pleasure In Doing That Things That Other People Say U Can't By Doing This U Can Shut Their Mouth
|
|
|
|
|
hi
What do you want to do with a HDD Serial number, for sure it changes when the HDD get formated. its not Stable, if you want this for Software protection thing, then i think you should go for Processor ID, that will never change.
Thanks
Vuyiswa Maseko,
Sorrow is Better than Laughter, it may Sadden your Face, but It sharpens your Understanding
VB.NET/SQL7/2000/2005
http://vuyiswamb.007ihost.com
http://Ecadre.007ihost.com
vuyiswam@tshwane.gov.za
|
|
|
|
|
I need to copy some of the selected rows from 1 excel file into another excel file through VB?
Also I need to serach in the second excel?
Can anybody help me???
|
|
|
|
|
|
--> How will i control the limit the occurences of a character in the textbox..?
For example i want hyphen("-") should not occur more than twice. How will i do this...
J A Nasir K
|
|
|
|
|
use below code
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If InStr(TextBox1.Text, e.KeyChar) Then
e.KeyChar = ""
End If
End Sub
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
hi,
Use the below mentioned code:
Dim i As Integer = 0
Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar = "a"c Or e.KeyChar = "A"c Then
i += 1
If i >= 3 Then
MsgBox("Sorry, letter 'a' has already been used Twice")
e.Handled = True
End If
End If
End Sub
I hope this would be helpful.
Vinay
ComponentOne LLC.
www.componentone.com
|
|
|
|
|
--> How can i restart or shutdown my computer from the dotNet application..?
J A Nasir K
|
|
|
|
|
Use Shutdown.exe
process.start("shutdown","-r")
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
--> What do you mean by "-r" in the second argument..?
J A Nasir K
|
|
|
|
|
Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "comment"] [-d up:xx:yy]
No args Display this message (same as -?)
-i Display GUI interface, must be the first option
-l Log off (cannot be used with -m option)
-s Shutdown the computer
-r Shutdown and restart the computer
-a Abort a system shutdown
-m \\computername Remote computer to shutdown/restart/abort
-t xx Set timeout for shutdown to xx seconds
-c "comment" Shutdown comment (maximum of 127 characters)
-f Forces running applications to close without warning
-d [u][p]:xx:yy The reason code for the shutdown
u is the user code
p is a planned shutdown code
xx is the major reason code (positive integer less than 256)
yy is the minor reason code (positive integer less than 65536)
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|