Link to home
Create AccountLog in
Avatar of DaveMon
DaveMonFlag for United States of America

asked on

cant link a textbox value to a progressbar value, need loop code

I have an app that connects to a com port and displays the temperature through a label control and a textbox control,  I also have a  Mabry indicator control that is coded to show the value of this textbox ( very similar to a progressbar). Currently,  the only  way  to see the gauge work  is  a button I made called "poll" which executes the code that syncs the text1 value with the gauge...If it is pressed before data is in the text1 box, an error is generated.  What I want, is after the com port is connected, for the poll gauge code to run and loop to update the gauge every so often so that it is a visual represention of the number value in the textbox.  So what I need is the poll button to be "pressed automatically"  and for it to loop endlessly  about  every 15-30  seconds,  BUT ONLY  after  com1 is connected and there is a value in the textbox.   Could someone  show me the  code for this?  I think  it  is  basically  a loop  with a few conditions. But  I have tried  a few things  and am  getting  nowhere.

DaveMon
Avatar of chaos_59
chaos_59

It seems like you could use the "Text_change" event from the text box control. When the text box gets updated from elsewhere the event will fire and you can execute the code that links the text box to your Mabry control.
If for some reason this doesn't work you can use the timer control to sync the textbox to the Mabry control. The timer control fires an event whenever it reaches a preset interval. Use the event to sync your controls and then reset the timer.
Avatar of DaveMon

ASKER



I briefly tried that with the text_change event  but had  no  luck.. I will try again though....would  the  code  be a goto  or call a function or sub....I tried text1.text = MabryCntrl.Value = ....under  the text_change event but that didnt  do it....can  you elaborate  on the timer  technique you meantioned?  As  I dont know much about  how to sync things.

DaveMon
ASKER CERTIFIED SOLUTION
Avatar of chaos_59
chaos_59

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of DaveMon

ASKER



Doh!   Sometimes  its  the  little  things  that  get  you  !!  I had  tried  this  same  code  severall times  in the  past  but to  no avail.....I was  omiting  the  "val"  part.......now  its  working  perfectly,  Thanks.


DaveMon