|
-
Jul 30th, 2004, 11:46 AM
#1
Thread Starter
Hyperactive Member
VB.NET equivalent ..
What is the VB.NET Equiv. of Functions like Fix, ASC and in which library can they be found ?
-
Jul 30th, 2004, 01:28 PM
#2
I wonder how many charact
VB Code:
'asc
Dim asciiValue As Integer = System.Text.Encoding.ASCII.GetBytes(c)(0)
-
Jul 30th, 2004, 01:30 PM
#3
Frenzied Member
the namespace is microsoft.visualbasic
-
Jul 30th, 2004, 01:35 PM
#4
I wonder how many charact
As far as Fix.... the framework will truncate if you cast a single of (3.5) into an integer, the .5 will drop off.
VB Code:
example:
Dim total As Integer = CType(3.2!, Integer)
Last edited by nemaroller; Jul 30th, 2004 at 01:42 PM.
-
Jul 30th, 2004, 02:23 PM
#5
Originally posted by Andy
the namespace is microsoft.visualbasic
I think that ends up being more of a crutch than helpfull.. if one is going to make the leap to VB.NET, just do it.... don't stick one foot on one side and one on the other.... commit or not.
TG
-
Jul 30th, 2004, 02:31 PM
#6
i agree.. i was looking for the left function and i was like "where the hell is it" looked it up in help and it said you HAVE to fully qualify it in a form because of the forms left property (this happened in VB6 with intellisense too)
then i realized that this functionality is built right into string objects like the substring method
-
Jul 30th, 2004, 04:59 PM
#7
Frenzied Member
i agree. I was just quoting what I found in the MSDN. Can you use those functions without importing that namespace? What ARE the equivalent .net methods?
-
Jul 30th, 2004, 05:09 PM
#8
Sleep mode
Do you know that there are some mathematical functions in the Math class ?
-
Jul 31st, 2004, 12:57 AM
#9
VB Code:
'Fix
Math.Ceiling '(If you pass 3.5 it will give 4)
Math.Floor ' (If you pass 3.5 it will give 3)
'both only return whole numbers
Tips:
- Google is your friend! Search before posting!
- Name your thread appropriately... "I Need Help" doesn't cut it!
- Always post your code!!!! We can't read your mind!!! (well, at least most of us!)
- Allways Include the Name and Line of the Exception (if one is occuring!)
- If it is relevant state the version of Visual Studio/.Net Framwork you are using (2002/2003/2005)
If you think I was helpful, rate my post  IRC Contact: Rizon/xous ChakraNET/xous Freenode/xous
-
Jul 31st, 2004, 06:44 AM
#10
I wonder how many charact
As far as I could ever tell, Fix simply truncates the decimal fraction of a number.... I guess its easier than typing out the conversion, perhaps not in c# though... result = (int)mySingle.
-
Jul 31st, 2004, 09:15 AM
#11
Frenzied Member
Originally posted by Pirate
Do you know that there are some mathematical functions in the Math class ?
is THAT what the Math class does?
-
Aug 1st, 2004, 07:35 PM
#12
Sleep mode
Originally posted by Andy
is THAT what the Math class does?
Ofcourse , I don't know mean that basic mathematical functions (+ - / *)....
-
Aug 2nd, 2004, 08:47 AM
#13
spoiledkid i hate to say this, and I am not being sarcastic at all, but in the MSDN help with .NET, if you look up those functions by name you will get the documentation on them
-
Aug 2nd, 2004, 09:30 AM
#14
Thread Starter
Hyperactive Member
I have seen the documentation on those, they are part of Microsoft.VisualBasic namespace which gives me a feeling that this namespace is just for backward compatibility ... I do not want to use anything of VB6 so I asked if there was a equivalent in .net
-
Aug 2nd, 2004, 09:34 AM
#15
yeah I have yet to find something in the Microsoft.VisualBasic namespace that there is not a .net function that does the same thing
-
Aug 2nd, 2004, 10:39 AM
#16
Thread Starter
Hyperactive Member
Originally posted by kleinma
yeah I have yet to find something in the Microsoft.VisualBasic namespace that there is not a .net function that does the same thing
-
Aug 2nd, 2004, 11:37 AM
#17
I wonder how many charact
-
Aug 2nd, 2004, 01:25 PM
#18
Thread Starter
Hyperactive Member
Originally posted by nemaroller
I like my car...
then go to chit-chat
-
Aug 2nd, 2004, 01:42 PM
#19
Hyperactive Member
The only VB6 -> .NET thing I am struggling with is the Format function. I have still not figured that one out.
For example, If I have a value x = 9, how do I format that to be 9.00? I have been using the microsoft.visualbasic namespace but would rather just use the framework to do the formatting.
-
Aug 2nd, 2004, 07:24 PM
#20
PowerPoster
Originally posted by VBGuy
The only VB6 -> .NET thing I am struggling with is the Format function. I have still not figured that one out.
For example, If I have a value x = 9, how do I format that to be 9.00? I have been using the microsoft.visualbasic namespace but would rather just use the framework to do the formatting.
VB.NET uses strings to format numbers
VB Code:
Dim mystring As String
Dim mynumber As Double = 9
mystring = FormatNumber(mynumber, 2)
gives the string 9.00
Taxes
The more I learn about VB.NET the more I like dBaseIII Plus
The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.
-
Aug 2nd, 2004, 09:36 PM
#21
I wonder how many charact
I have been using the microsoft.visualbasic namespace but would rather just use the framework to do the formatting.
Here you go, just use an overloaded method of the ToString function:
VB Code:
Dim my9 As Single = 9.121
Dim myString As String = my9.ToString("#.00"))
'gives 9.12
Dim myDouble As Double = 1234567890
Dim myString As String = myDouble.ToString( "(###) ### - ####" )
' gives (123) 456 – 7890
'or use the Format function
Dim price As Double = 3.21
Dim myString As String = String.Format("{0:c}", price)
' gives $3.21
http://msdn.microsoft.com/library/de...matstrings.asp
http://msdn.microsoft.com/library/de...matstrings.asp
Last edited by nemaroller; Aug 2nd, 2004 at 09:52 PM.
-
Aug 2nd, 2004, 10:44 PM
#22
Frenzied Member
this post or a gathering of the c#/vb.net commands that are used to convert one another would make a great sticky or FAQ.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|