vb.net 2013 - double?

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
5 posts Page 1 of 1
Contributors
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

vb.net 2013 - double?
Dummy1912
hello,

does anyone know how i can convert a double without a negative ()

it seems i get (£50.00) - this is a negative value

but i like to have it as -£50.00

i use:
Code: Select all
Dim l As Double
l = cDAL.VarToDbl(Label6.Text + Amount1) 'amount1 is a double
lblrunning.Text =  Format(l, "c")
cDAL:
Code: Select all
Public Shared Function VarToDbl(ByVal o As Object) As Decimal

        Try
            Return Decimal.Parse(o.ToString)
        Catch
            Return 0
        End Try

    End Function
thanks
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
smashapps
Coding Guru
Coding Guru
Posts: 961
Joined: Tue Apr 05, 2011 8:41 am

Re: vb.net 2013 - double?
smashapps
I don't know if I completely understood what you meant or not.
Code: Select all
Dim doub As Double = 10.0R

        Label1.Text = doub + TextBox1.Text
If the number is negative it will still display as -something instead of something
My name is Tom | Visit my blog where I post new content every day! Tom's Daily Blog | MineCraft is awesome!
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: vb.net 2013 - double?
Dummy1912
hello #smashapps

do you know a other way as well?
because it seems i can't use a R after my double values
because

amount += amount & "R" don't work

if i remove this part then it works fine but then we don't get the £ before the value
Code: Select all
lblrunning.Text =  Format(l, "c")
this part shows the value with £
but then if value is - then it shows like
(£50.00) instead of -£50.00
Code: Select all
lblrunning.Text =  Format(l, "c")
Last edited by Dummy1912 on Wed May 28, 2014 3:47 pm, edited 1 time in total.
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
XTechVB
VIP - Site Partner
VIP - Site Partner
Posts: 727
Joined: Thu May 20, 2010 10:32 am

Re: vb.net 2013 - double?
XTechVB
What's "Label6.Text"? what value does it hold?
You can find me on Facebook or on Skype mihai_92b
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: vb.net 2013 - double?
Dummy1912
hello #XTechVB

that contains just a amount like for example 50.00
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
5 posts Page 1 of 1
Return to “Coding Help & Support”