Results 1 to 16 of 16

Thread: Quick one please

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2001
    Posts
    130

    Quick one please

    OK guys here is what I am trying to do.

    rsrat = ?? ' this ?? is a hex number for 0 to F
    what I need is to make a simple formula so that when I do this

    rs.text = rsrat

    it shows up as a number 1 throw a hundred not 0 to F

    I want F to be 94-100
    I want E to be 88-94
    I want D to be 82-88
    and so on down to
    I want 0 to be 0-7

    did I say that correctly???

    I then will have a + sign then a text box in the middle and a minus sign on the right.
    I then want to be able to click the plus or minus and change it groups of six so it stays in form with above???
    what is the simplest task to do that???

    and also where would you but it????


    Thanks,
    Long lost Matt

  2. #2
    Hyperactive Member TiPeRa's Avatar
    Join Date
    Apr 2001
    Location
    In between
    Posts
    464
    You've confused me!
    W#Ć€V€® W¦|| ߀ W¦|| ߀, ÄÑÐ †#€®€ ¦§ ÑÖ†#¦Ñ6 ¥Öµ ©ÄÑ ÐÖ ÄßÖµ† ¦†, §Ö §¦† ßÄ©K, ®€|ÄX ÄÑÐ |€† ¦† #ÄÞÞ€Ñ.
    (Whatever will be will be, and there is nothing you can do about it, so sit back, relax and let it happen.)

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2001
    Posts
    130
    ok I got rsrat which is getting a chr of hex from a file

    it will be either 0 to F

    then I got rs.text I dont want RS.text to say a hex number so I want to convert it some how so its like this

    rsrat =F then
    rs.text=100
    rsrat =E then
    rs.text =94


    i guess I could type this 15 times but I thought there would be a more simple way

  4. #4

    Thread Starter
    Addicted Member
    Join Date
    Apr 2001
    Posts
    130
    the only reason I dont want to type that 15 times is cause I got

    10 diffrent ratings and 15 x 10 wheew alot of code if there is a simpler way

  5. #5
    coolboris
    Guest

    Smile

    I think you shuold do something like this:
    assuming rstat is string with 1 symbol


    if Asc(rsrat)>64 and Asc(rsrat)<71 then
    rs.text =(Asc(rsrat)-64)*6+58 'for lower limit (like for F -> 94)
    rs.text =(Asc(rsrat)-64)*6+64 'for upper limit (like for F -> 100)
    end if

    if Asc(rsrat)>47 and Asc(rsrat)<58 then
    rs.text =(Asc(rsrat)-48)*7 'for lower limit (like for 0 -> 1)
    rs.text =(Asc(rsrat)-48)*7+7 'for upper limit (like for 0 -> 7)
    end if


    I didn't try it in VB

  6. #6
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Try doing something like this:
    Code:
    Dim vValues As Variant
    vValues = Array( _
     7, 13, 19, 35, 31, 37, 43, _
     49, 55, 61, 67, 73, _
     79, 85, 91, 100) ' or whatever values you wanted
    rsrat = F ' for example
    rs.Text = vValues(CLng("&H" & rsrat))
    Best regards

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    Apr 2001
    Posts
    130
    ok maybe I am stating this wrong


    I have a procedure where I go and get 10 ratingsRS.Text = RSrat
    RP.Text = RPrat
    MS.Text = MSrat
    HP.Text = HPrat
    QK.Text = qkrat
    PICK.Text = PICKRAT

    those are some of them everyone with the rat is the hex rating


    right now I have it going from there just to the text file as you can see

    but it will be hard for my users to understand that(look at pic below)

    so what I want to do if any of the hex ratings are F I want the dec to be 100 ??? for all 10 and If it is E then I want the DEC to be 94 and if E I want it to be 88 so when you see the rs rating it might be a E hex but the user will see Running speed 88


    please look at the pic it might explain it better

    thanks
    Matt
    Attached Images Attached Images  

  8. #8
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Well if you look at my code in my earlier post that is exactly what its doing.
    In the Array simply change the values to what ever you want them to be.
    The first value would be for &H0 and the last for &HF.

    Best regards

  9. #9

    Thread Starter
    Addicted Member
    Join Date
    Apr 2001
    Posts
    130
    code:--------------------------------------------------------------------------------
    Dim vValues As Variant
    vValues = Array( _
    7, 13, 19, 35, 31, 37, 43, _
    49, 55, 61, 67, 73, _
    79, 85, 91, 100) ' or whatever values you wanted
    rsrat = F ' for example
    rs.Text = vValues(CLng("&H" & rsrat))

    so is this what you mean

    code:--------------------------------------------------------------------------------
    Dim vValues As Variant
    vValues = Array( _
    7, 13, 19, 24, 30, 36, 42, _
    48, 54, 60, 66, 72, _
    78, 84, 90, 96, 100) ' or whatever values you wanted
    'now below would make hex 0 the first number in the aboce array????
    'and then I would add this to every rating like this
    rs.Text = vValues(CLng("&H" & rsrat))
    rp.Text = vValues(CLng("&H" & rprat))
    ms.Text = vValues(CLng("&H" & msrat))
    hp.Text = vValues(CLng("&H" & hprat))

    thanks if this is correct what would I do in the plus in minus buttons to make then raise and lower the hex value

    would I put int the +click command
    rsrat +1
    ?
    thanks sorry if I am slow at this

    Matt

  10. #10

    Thread Starter
    Addicted Member
    Join Date
    Apr 2001
    Posts
    130
    anyone??

  11. #11
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    I assume rsrat is declared as a string. In that case use the following code:
    Code:
    rsrat = Hex(CInt("&H" & rsrat) + 1)

  12. #12

    Thread Starter
    Addicted Member
    Join Date
    Apr 2001
    Posts
    130
    yeah I do have rsrat declared a string but this wont work
    I get a type mismatch????

    Private Sub RSMI_Click()' this is the minus button
    RSrat = Hex(CInt("&H" & RSrat) - 1)
    End Sub

    Private Sub RSPL_Click()' this is the plus button
    RSrat = Hex(CInt("&H" & RSrat) + 1)

    End Sub
    thanks,
    Matt

  13. #13
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Hmmm... I don't get any errors.
    Does RSrat have any value when you enter the click events?
    Try this:
    Code:
    Private Sub RSMI_Click()
        MsgBox RSrat
    End Sub
    Make sure that RSrat only has a value between 0 and F.

    Best regards

  14. #14

    Thread Starter
    Addicted Member
    Join Date
    Apr 2001
    Posts
    130
    would rsrat still have a value????


    it was giving a value in the form load procedure??
    did it lose its value???
    thanks
    MAtt

  15. #15

    Thread Starter
    Addicted Member
    Join Date
    Apr 2001
    Posts
    130
    yeah I just ran it and it was empty

    why is that in the same form I gave it a value????

  16. #16
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Where is rsrat declared? Do you use Option Explicit? If not DO!

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