Results 1 to 2 of 2

Thread: Doing Hexadecimal Math

  1. #1
    Guest

    Smile

    I am trying to make a program that will do math in the Hexadecimal system but I have no idea how to set it up to do the math in Hex.

    Here's a more detailed explination of what I want to do:

    The user inputs an 8-digit hexadecimal into a text field, then there are 6 buttons. By clicking 1 of the buttons, it subtracts a hexadecimal value specified by the button (ex. 4C0) from the inputed value and displays it in another text field.

    Could somebody assist me in making this over AOL or something? Or be a really nice person and make the program for me? I could do some graphics for you if you wanted in exchange... anything in web design I can do...

    AOL Name: Kukyfrope2
    IM me if you can or want to try and help me!

    Thanks!
    Kuky

  2. #2
    Fanatic Member
    Join Date
    Feb 2000
    Location
    Japan
    Posts
    840

    You'll need to catch non-hex test before you call this otherwise you'll get type mismatches

    Code:
    Private Sub Command1_Click()
    
        Dim x As Long
        Dim y As Long
        Dim Ans As Long
        
        x = CLng("&H" & Text1.Text)
        y = CLng("&H" & Text2.Text)
        Ans = x - y
        Label1.Caption = Hex(Ans)
    
    End Sub

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