Results 1 to 5 of 5

Thread: Console Application To HTML

  1. #1

    Thread Starter
    New Member
    Join Date
    Oct 2011
    Posts
    3

    Question Console Application To HTML

    How would I go about modifying the following console application? It calculates resistor color codes and I need it to be able to launch or work directly from a HTML web page. Any help would be appreciated. Thanks in advance.

    (I'm well aware my calculator can be simplified with case statements and loops, only bother with that if you want to.)

    Code:
    :Module Module1
    
        Sub Main()
            Dim tens As Integer
            Dim ones As Integer
            Dim expnt As Integer
            Dim tol As String
            Dim answer As Long
    readcolor1:
            Console.Write("Please enter your first color: ")
            Dim color1 As String = Console.ReadLine().ToLower
            If color1 = "black" Then
                tens = 0
            ElseIf color1 = "brown" Then
                tens = 1
            ElseIf color1 = "red" Then
                tens = 2
            ElseIf color1 = "orange" Then
                tens = 3
            ElseIf color1 = "yellow" Then
                tens = 4
            ElseIf color1 = "green" Then
                tens = 5
            ElseIf color1 = "blue" Then
                tens = 6
            ElseIf color1 = "violet" Then
                tens = 7
            ElseIf color1 = "grey" Then
                tens = 8
            ElseIf color1 = "gray" Then
                tens = 8
            ElseIf color1 = "white" Then
                tens = 9
            Else : Console.Write("You entered an incorrect color. ")
                GoTo readcolor1
            End If
    readcolor2:
            Console.Write("Please enter your second color: ")
            Dim color2 As String = Console.ReadLine().ToLower
            If color2 = "black" Then
                ones = 0
            ElseIf color2 = "brown" Then
                ones = 1
            ElseIf color2 = "red" Then
                ones = 2
            ElseIf color2 = "orange" Then
                ones = 3
            ElseIf color2 = "yellow" Then
                ones = 4
            ElseIf color2 = "green" Then
                ones = 5
            ElseIf color2 = "blue" Then
                ones = 6
            ElseIf color2 = "violet" Then
                ones = 7
            ElseIf color2 = "grey" Then
                ones = 8
            ElseIf color2 = "gray" Then
                ones = 8
            ElseIf color2 = "white" Then
                ones = 9
            Else : Console.Write("You entered an incorrect color. ")
                GoTo readcolor2
            End If
    readcolor3:
            Console.Write("Please enter your third color: ")
            Dim color3 As String = Console.ReadLine().ToLower
            If color3 = "black" Then
                expnt = 0
            ElseIf color3 = "brown" Then
                expnt = 1
            ElseIf color3 = "red" Then
                expnt = 2
            ElseIf color3 = "orange" Then
                expnt = 3
            ElseIf color3 = "yellow" Then
                expnt = 4
            ElseIf color3 = "green" Then
                expnt = 5
            ElseIf color3 = "blue" Then
                expnt = 6
            ElseIf color3 = "violet" Then
                expnt = 7
            ElseIf color3 = "grey" Then
                expnt = 8
            ElseIf color3 = "gray" Then
                expnt = 8
            ElseIf color3 = "white" Then
                expnt = 9
            Else : Console.Write("You entered an incorrect color. ")
                GoTo readcolor3
            End If
    readcolor4:
            Console.Write("Please enter your fourth color: ")
            Dim color4 As String = Console.ReadLine().ToLower
            If color4 = "gold" Then
                tol = "+/- 5%"
            ElseIf color4 = "silver" Then
                tol = "+/- 10%"
            Else : Console.Write("You entered an incorrect color. ")
                GoTo readcolor4
            End If
    
            answer = ((tens * 10) + ones) * 10 ^ expnt
            Console.Write(answer & " OHMS " & tol)
            Console.ReadLine()
            GoTo readcolor1
        End Sub
    
    End Module
    Last edited by NicTyn; Oct 31st, 2011 at 05:24 PM.

  2. #2

    Thread Starter
    New Member
    Join Date
    Oct 2011
    Posts
    3

    Re: Console Application To HTML

    Why the **** can we not delete our own posts?
    Last edited by NicTyn; Nov 1st, 2011 at 05:57 PM.

  3. #3

    Re: Console Application To HTML

    We usually go by a rule of thumb of don't bump within 24 hours with no useful information. Not sure if it's an official rule or not.

    You want this to work inside a webpage, right? Is that what you're asking?
    As for the usage of GoTo and Labels, well, that's old VB6 style programming IMHO. I'd touch it but I don't care to right now, not enough energy.

  4. #4

    Thread Starter
    New Member
    Join Date
    Oct 2011
    Posts
    3

    Re: Console Application To HTML

    Okay, still need help, and yet this made the second page before bumping. Do I have to concisely say please?

  5. #5
    Fanatic Member BlindSniper's Avatar
    Join Date
    Jan 2011
    Location
    South Africa
    Posts
    865

    Re: Console Application To HTML

    forget HTML.If you want it on a Website you can use ASP.NET, or Javascript which might be easier to integrate into a website.

    Take a look at. http://www.dannyg.com/examples/res2/resistor.htm

    Useful CodeBank Entries of mine
    Expand Function
    Code Compiler
    Sudoku Solver
    HotKeyHandler Class

    Read this to get Effective help on VBForums
    Hitchhiker's Guide to Getting Help at VBF

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width