Results 1 to 8 of 8

Thread: Number Lines in VB?? Need help. ;) {RESOLVED} THANKS DIGLIENNA!!

  1. #1

    Thread Starter
    Hyperactive Member stilekid007's Avatar
    Join Date
    Apr 2005
    Location
    DUDE! I'm your neighbor! HELLO!!!
    Posts
    388

    Wink Number Lines in VB?? Need help. ;) {RESOLVED} THANKS DIGLIENNA!!

    Hello,

    I have a Form and on it is 2 labels and 2 lines (Inside of a picture box).

    Now the user clicks on a certain point of the Picture box and the first Label and Line become visible and the label caption is a number previously entered(eg 85.31) Now the Line and label are both displayed where the mouse clicked.

    Then the user clicks down lower on the Picture and it displays the 2nd Label and Line. Again the label caption is a number previously entered (eg 83.31)

    Now what I need this to do is. Subtract the low from the high (85.31 - 83.31) and multiply by 0.50 and then add it to 83.31. (=84.31)

    I know how to do all that coding BUT what I need help with is this.

    Once it calculates that, I need it to make the 2 lines as if they were a number (85.31 - 83.31) and then I need it to find where 84.31 (Result) would be on the picture if 85.31 was line1 and Line2 was 83.31, and 84.31 is where it would put Line 3.

    I have all the lines allready figured out I just need to know how to get it to put Line 3 where it calcualted (84.31)

    Does anyone know how I could pull this off?

    If you need me to explain more just let me know.

    Thank you so much
    Stilekid007
    Last edited by stilekid007; Jun 13th, 2005 at 07:22 PM.

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Very weird question! Can't explain it in a sentence! ;)

    Post your code. Are you talking about a number line? You would have to set the scale of your contol to be able to find a point. Or maybe you want to use a graph control, which has an x axis by default.

  3. #3

    Thread Starter
    Hyperactive Member stilekid007's Avatar
    Join Date
    Apr 2005
    Location
    DUDE! I'm your neighbor! HELLO!!!
    Posts
    388

    Re: Very weird question! Can't explain it in a sentence! ;)

    Hello dglienna!

    Here is the Program.
    THANK YOU!
    Attached Files Attached Files

  4. #4

    Thread Starter
    Hyperactive Member stilekid007's Avatar
    Join Date
    Apr 2005
    Location
    DUDE! I'm your neighbor! HELLO!!!
    Posts
    388

    Re: Number Lines in VB?? Need help. ;)

    hmm I did some searches and couldn't come up with anything that was right for me.. Does anyone know what I could do?

    Thank you for any suggestoins!
    Stilekid007

  5. #5
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Number Lines in VB?? Need help. ;)

    I had to scale it, which you proably wanted.
    You may have to tweak it. I don't know why you used the timers, You can remove them, and display the messages in the form_activate property, which you will have to create. You also don't need the other form with the textboxes. At least it does what you want.
    Attached Files Attached Files

  6. #6

    Thread Starter
    Hyperactive Member stilekid007's Avatar
    Join Date
    Apr 2005
    Location
    DUDE! I'm your neighbor! HELLO!!!
    Posts
    388

    Re: Number Lines in VB?? Need help. ;)

    Hello Diglienna! That is some amazing code! I wouldn't have been able to figure it out even though it looks so simple, now that it is all done .

    I have one question about this piece of code in the program.

    Code:
    X3 = (Picture1.ScaleWidth - Picture1.ScaleLeft) / 2
    y3 = lnMed.Y2 + 0.8
    Label3.Move X3, y3
    What is X3 and Y3 for?

    I get an error Variable not defind for those 3 lines of code above.

    I put Dim X3 As Single (Just to get the error out of there) but what shoud I put instead of Dim as Single?

    Thank you so much man! I really appreciate all your help!
    Stilekid007

  7. #7
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: Number Lines in VB?? Need help. ;)

    Quote Originally Posted by stilekid007
    Hello Diglienna! That is some amazing code! I wouldn't have been able to figure it out even though it looks so simple, now that it is all done .

    I have one question about this piece of code in the program.

    Code:
    X3 = (Picture1.ScaleWidth - Picture1.ScaleLeft) / 2
    y3 = lnMed.Y2 + 0.8
    Label3.Move X3, y3
    What is X3 and Y3 for?

    I get an error Variable not defind for those 3 lines of code above.

    I put Dim X3 As Single (Just to get the error out of there) but what shoud I put instead of Dim as Single?

    Thank you so much man! I really appreciate all your help!
    Stilekid007

    X3 and Y3 should be declared as LONG. You didn't have Option Explicit turned on in your app, otherwise that would have forced me to define it for you

    If you omit that section of code, label3 won't be able to follow the line. Right now, it appear directily underneath the line, and in the center of the screen.

    Hope you got rid of the Timers. You rarely need more than one. If you wanted messages, you should set the interval to seconds * 1000, or 5000 for 5 seconds.

    The hardest part was making it work whether or not the first line drawn was the one on top or not. That's what the code that checks whether lnhigh is > than lnlow!

    If I hadn't scaled it, it would have had numbers up to 27000, or the height of the picturebox in twips. Now, all lines are between 1 and 100.

    Glad you like it. Hope you understand most of it!

  8. #8

    Thread Starter
    Hyperactive Member stilekid007's Avatar
    Join Date
    Apr 2005
    Location
    DUDE! I'm your neighbor! HELLO!!!
    Posts
    388

    Re: Number Lines in VB?? Need help. ;)

    Oh I see! well that is really helpfull! Thank you so much!
    Stilekid007
    P.S. I did remove the Timers! Form_Active worked alot better!

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