Click here to Skip to main content
15,887,214 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Variable Question Pin
DJHJr28-Apr-14 6:22
DJHJr28-Apr-14 6:22 
Questionrunning AxAcroPDF in a dialog, right choice or not Pin
jkirkerx20-Apr-14 9:49
professionaljkirkerx20-Apr-14 9:49 
QuestionHelp... Again... Pin
Member 1072866720-Apr-14 6:42
Member 1072866720-Apr-14 6:42 
AnswerRe: Help... Again... Pin
Member 1072866720-Apr-14 6:44
Member 1072866720-Apr-14 6:44 
GeneralRe: Help... Again... Pin
Wes Aday20-Apr-14 7:03
professionalWes Aday20-Apr-14 7:03 
GeneralRe: Help... Again... Pin
Member 1072866720-Apr-14 8:13
Member 1072866720-Apr-14 8:13 
GeneralRe: Help... Again... Pin
Wes Aday20-Apr-14 8:36
professionalWes Aday20-Apr-14 8:36 
GeneralRe: Help... Again... Pin
Tino Fourie24-Apr-14 7:00
Tino Fourie24-Apr-14 7:00 
Not entirely sure what Language you are using here but it looks very much like VB. Therefore assuming that it is VB.

On the surface your code looks correct. If I had to rewrite the code it would look something like this:

VB
Module Module1

Dim distance As Decimal = 0
Dim answer As String = nothing
 

Sub Main()
   Console.WriteLine("Do you want to convert miles or kilometers? (M or K)")
   answer = Console.ReadLine()

   Console.WriteLine("What is the distance?")
   distance = Console.ReadLine()

   If answer = "M" Then
      Console.WriteLine("The converted value is: " convertToKM(distance))
   Else
      Console.WriteLine("The converted value is: " & converToML(distance))
   End If
 
   Console.ReadLine()
End Sub
 
Function convertToKM(distance) As Decimal
   Dim km as Decimal = 0

   km = distance / 0.62137
   Return km
End Function
 
Function convertToML(distance) As Decimal
   Dim ml as Decimal = 0

   ml = distance * 0.62137
   Return ml
End Function

End Module

QuestionAbout handling MSComm events in VB6 Pin
Member 1056890820-Apr-14 5:20
Member 1056890820-Apr-14 5:20 
AnswerRe: About handling MSComm events in VB6 Pin
Eddy Vluggen21-Apr-14 8:18
professionalEddy Vluggen21-Apr-14 8:18 
GeneralRe: About handling MSComm events in VB6 Pin
Member 1056890821-Apr-14 14:27
Member 1056890821-Apr-14 14:27 
GeneralRe: About handling MSComm events in VB6 Pin
Eddy Vluggen21-Apr-14 22:33
professionalEddy Vluggen21-Apr-14 22:33 
GeneralRe: About handling MSComm events in VB6 Pin
Nicholas Marty22-Apr-14 0:06
professionalNicholas Marty22-Apr-14 0:06 
GeneralRe: About handling MSComm events in VB6 Pin
Member 105689083-May-14 21:41
Member 105689083-May-14 21:41 
QuestionRounding To 2 Decimal Places Pin
Member 1072866719-Apr-14 16:46
Member 1072866719-Apr-14 16:46 
AnswerRe: Rounding To 2 Decimal Places Pin
Richard MacCutchan19-Apr-14 21:22
mveRichard MacCutchan19-Apr-14 21:22 
QuestionQueue and Stack Pin
DJHJr17-Apr-14 8:04
DJHJr17-Apr-14 8:04 
AnswerRe: Queue and Stack Pin
Eddy Vluggen17-Apr-14 8:31
professionalEddy Vluggen17-Apr-14 8:31 
GeneralRe: Queue and Stack Pin
DJHJr17-Apr-14 9:07
DJHJr17-Apr-14 9:07 
GeneralRe: Queue and Stack Pin
Eddy Vluggen17-Apr-14 10:24
professionalEddy Vluggen17-Apr-14 10:24 
Questionfilesystemwatcher possible infinite loop Pin
Tony Snowden17-Apr-14 0:20
Tony Snowden17-Apr-14 0:20 
AnswerRe: filesystemwatcher possible infinite loop Pin
Richard Andrew x6417-Apr-14 0:45
professionalRichard Andrew x6417-Apr-14 0:45 
GeneralRe: filesystemwatcher possible infinite loop Pin
Tony Snowden17-Apr-14 1:07
Tony Snowden17-Apr-14 1:07 
QuestionHow to Run Transparent Flash Files Over a Running Video in VB Pin
NAVEEN SONI16-Apr-14 17:56
NAVEEN SONI16-Apr-14 17:56 
QuestionPass a string to a control on a form from a remoting connection Pin
ParadoxLiving15-Apr-14 20:27
ParadoxLiving15-Apr-14 20:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.