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.
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.
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.
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.