-
Re: Please Help Create A VB6 to .NET Function Conversion Chart [Final Draft]
Quote:
Originally Posted by eyeRmonkey
JMC, could you explain how/when/why I would call format on a class? I'm not sure I follow you on that one.
If you have a single object that you want to convert to a string and specify a format then you would normally call the ToString method of that object. If you want to insert an object into a string at a specific point or you have multiple object s that you want to put into a string then you would normally use String.Format. String.Format allows you to specify the same format strings that you can pass to ToString.
Quote:
Originally Posted by eyeRmonkey
I updated the page. Does it look more correct JMC?
There's still an error with Format. String.Format is a Shared method so you don't call it on a String object, but rather on the String class itself, i.e.
Format => [String object].Format 'this is wrong.
Format => String.Format 'this is correct.
-
Re: Please Help Create A VB6 to .NET Function Conversion Chart [Final Draft]
Nevermind. I understand now. That totally makes sense. I knew that, I just wasn't making the connection for some reason. Thanks. :)
(If I could rep you as much as you deserved it, my finger would be bruised. ;))
EDIT: I know this sounds ridiculous, but would the proper way to acheive the VB6 equivalent of Format be to do [String Object].ToString([Format String Here])? Or is there a way that seems less... odd? String.Format() doesn't do the same thing as in .NET as it did in VB6, so I can't list it as the equivalent.
-
Re: Please Help Create A VB6 to .NET Function Conversion Chart [Final Draft]
Quote:
Originally Posted by eyeRmonkey
EDIT: I know this sounds ridiculous, but would the proper way to acheive the VB6 equivalent of Format be to do [String Object].ToString([Format String Here])? Or is there a way that seems less... odd? String.Format() doesn't do the same thing as in .NET as it did in VB6, so I can't list it as the equivalent.
I hadn't previously looked to see what the Format function did. It just seems to be a more generalised version of FormatCurrency, FormatDateTime, etc., so the equivalent would be something like [Object].ToString([Format String Here]) because it's a date or number that you're converting to a string.
-
Re: Please Help Create A VB6 to .NET Function Conversion Chart [Final Draft]
Yeah, that makes sense. I was thinking I needed to specify exactly what the [Object] was, but keeping it generalized works fine. I'll upload the new version now.
-
Re: Please Help Create A VB6 to .NET Function Conversion Chart [Final Draft]
Quote:
Originally Posted by eyeRmonkey
Shhhhhhhhh!
I was feeling lazy. I moved it to appalling FrontPage-generated HTML code. ;)
OK.
Take 3 steps back.
Now put the FrontPage down. Slowly.
http://penagate.spiralmindsinc.com/misc/functions.html
(You might need to update the content slightly ;))
-
Re: Please Help Create A VB6 to .NET Function Conversion Chart [Final Draft]
*bursts into tears*
... It's so ... Beautiful. :p
I was actually going to ask if someone would be willing to make it look nice for me. Did you hand code that? Or did you use an editor? It looks awesome. I wish I could rep you right now. Thanks!
-
Re: Please Help Create A VB6 to .NET Function Conversion Chart [Final Draft]
No problemo :)
Hand code ;) I use Notepad++.
Move the CSS to a stylesheet if you want to save some more bandwidth, along with the savings from lack of Frontpage/Word muck :p
Edit: Mighta missed a few "deprecated"'s somewhere
-
Re: Please Help Create A VB6 to .NET Function Conversion Chart [Final Draft]
Penagte, I must say, you are an artist at heart. You have a gift for that kind of thing. I can code with the best of them, but I'm not much of a designer. I'm not horrible, but I am far form amazing.
Good work, I'll check out stuff and make sure it is all up to date.
-
Re: Please Help Create A VB6 to .NET Function Conversion Chart [Final Draft]
I just noted that you have not provided a replacement for Oct. You can use Convert.ToString([Integer], 8) to create an octal representation of a number and Convert.ToInt32([String], 8) to create a number from an octal string. The same thing works with bases 2, 10 and 16.
-
Re: Please Help Create A VB6 to .NET Function Conversion Chart [Final Draft]
Yeah, I had it updated at some point, and it got lost between updates or something. Thanks. :)
-
Re: Please Help Create A VB6 to .NET Function Conversion Chart [Final Draft]
Quote:
Originally Posted by eyeRmonkey
Yeah, I had it updated at some point, and it got lost between updates or something. Thanks. :)
Ah, i looked a penagate's version I think. It's his fault. :)
-
Re: Please Help Create A VB6 to .NET Function Conversion Chart [Final Draft]
:lol:
The link in the first post now leads to the updated version with Penagate's design.
-
Re: Please Help Create A VB6 to .NET Function Conversion Chart [Final Draft]
What on earth happened to my poor code layout :lol:
-
Re: Please Help Create A VB6 to .NET Function Conversion Chart [Final Draft]
Int() is equivalent to Math.Floor(). Fix() is NOT equivalent to Math.Floor(). Fix behaves like Math.Floor for positive numbers and Math.Ceiling for negative numbers. The closest thing to Fix is Decimal.Truncate, but that only acts on Decimals, not Doubles or Singles.
-
Re: Please Help Create A VB6 to .NET Function Conversion Chart [Final Draft]
Thanks agian. I didn't think that was right, but I didn't know exactly what Fix did, so I just put Math.Floor there. Fix sounds like the greatest integer function (from math).
-
Re: Please Help Create A VB6 to .NET Function Conversion Chart [Final Draft]
Quote:
Originally Posted by penagate
What on earth happened to my poor code layout :lol:
:bigyello:
It is still just the way you left it. :p
I even kept your random use of capitalization and what not. Hehe.
Looks great Penagate. Thanks again. :thumb:
-
Re: Please Help Create A VB6 to .NET Function Conversion Chart [Final Draft]
Eh... my source code is completely different... :confused:
Somehow your version manages to have the same effect, but with added, as you say, random capitalisation and what not.
In case your View Source function is malfunctioning, here's the original code :p
http://penagate.spiralmindsinc.com/misc/functions.htmls
-
Re: Please Help Create A VB6 to .NET Function Conversion Chart [Final Draft]
:sigh: Somehow the way I saved it screwed it up. The actual code looks perfect (as proper XHTML should - even though you have HTML 4.01 as your doc type). Anyway, I don't really want to make all the changes again just so the source looks nice, but I might if it isn't too much trouble.
Also, I changed the URL, so if anyone bookmarked it or something you will need to change it. Sorry for any trouble that causes, but I wanted to make it easy to remember and an ASP page so I could add other functionality later.
-
Re: Please Help Create A VB6 to .NET Function Conversion Chart [Final Draft]
Thanks for all your work, have added it to my favourites as am always getting confused with Vb6 and .net.
-
Re: Please Help Create A VB6 to .NET Function Conversion Chart [Final Draft]
-
Re: Please Help Create A VB6 to .NET Function Conversion Chart [Completed]
Just came across this method to reverse a string. It's a bit better than using a loop.
VB Code:
Dim str As String = "This is a test"
Dim c() As Char
c = str.ToCharArray
Array.Reverse(c)
Messagebox.Show(Cstr(c))
-
Re: Please Help Create A VB6 to .NET Function Conversion Chart [Completed]
If it didn't take so many lines I might do it, but the most compact I can get it is:
VB Code:
Dim C() As Char = Array.Reverse(MyString.ToCharArray) : MyString = Convert.ToString(C)
I guess I could list that, but it seems a little too complex. It isn't as straight forward as the other things.
-
Re: Please Help Create A VB6 to .NET Function Conversion Chart [Completed]
THe code shown for Oct is converting to base 16 (hex)...
Bill
-
Re: Please Help Create A VB6 to .NET Function Conversion Chart [Completed]