3 Replies - 100 Views - Last Post: 07 February 2012 - 12:20 PM Rate Topic: -----

Topic Sponsor:

#1 Kalle114  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 01-February 12

dTemp decimal

Posted 07 February 2012 - 11:46 AM

Public Class CurrencyConverter
    Private summation As Decimal
    Private sum As Decimal
    Private curryncy As String
    Private exchange As Decimal
    Private final As Decimal
    Public Sub Start()
        WriteProgramInfo()
        ReadValuesAndSumNumbers()
        WriteResult()
    End Sub

    Private Sub WriteProgramInfo()
        Console.WriteLine(vbLf & "++++++ Finnish input type 0 ++++++")
    End Sub
    Private Sub ReadValuesAndSumNumbers()
        Dim done As Boolean = False
        summation = 0
        Do While (Not done)
            Console.Write(vbLf & "What is the number you want: ")
            summation = Decimal.Parse(Console.ReadLine())
            sum += summation
            done = summation = 0
        Loop
        Console.WriteLine("The sum of it is:" & sum)
        Console.Write("Currency name: ")
        curryncy = Console.ReadLine()
        Console.Write("Enter the exchange rate: ")
        Decimal.dTemp = 0
        decimal.TryParse(Console.ReadLine(), out dTemp)
        exchange = dTemp
        final = sum * exchange
    End Sub
    Private Sub WriteResult()
        Console.WriteLine("-------------------------------------------------------")
        Console.WriteLine(sum & " converted to " & final & curryncy)
    End Sub

End Class



i get this error in this program.
'dTemp' is not a member of 'Decimal'
'out' is not declared. It may be inaccessible due to its protection level
Comma, ')', or a valid expression continuation expected.
'dTemp' is not declared. It may be inaccessible due to its protection level.

yes the dTemp if from c# but i cant figuer out how to change it so it work in vb.net

Is This A Good Question/Topic? 0
  • +

Replies To: dTemp decimal

#2 modi123_1  Icon User is offline

  • Suiter #2
  • member icon


Reputation: 3561
  • View blog
  • Posts: 14,989
  • Joined: 12-June 08

Re: dTemp decimal

Posted 07 February 2012 - 11:55 AM

Decimal.dTemp = 0


You are failing to initialize the variable right.

dim <variable name> <type> = <starting value>
Dim dTemp as Decimal = 0

Was This Post Helpful? 0
  • +
  • -

#3 Kalle114  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 18
  • Joined: 01-February 12

Re: dTemp decimal

Posted 07 February 2012 - 12:01 PM

thx for the help
Was This Post Helpful? 0
  • +
  • -

#4 Ryano121  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 533
  • View blog
  • Posts: 1,283
  • Joined: 30-January 11

Re: dTemp decimal

Posted 07 February 2012 - 12:20 PM

As a side note Decimal.dTemp = 0 wouldn't compile in C# either...
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1