Solved

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

Posted on 2000-03-13
4
285 Views
Last Modified: 2013-12-25
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
0
Comment
Question by:DaveMon
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 1

Expert Comment

by:chaos_59
ID: 2613321
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.
0
 
LVL 2

Author Comment

by:DaveMon
ID: 2613392


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
0
 
LVL 1

Accepted Solution

by:
chaos_59 earned 50 total points
ID: 2613436
If you want the Mabry control to display the value of the text box use "mabrycntrl.value = val(text1.text)".
You should try using the text_change event first. It's a lot cleaner than putting in a timer control. If you use the timer control you will have to worry about setting the interval to something that is fast enough to get the response you want without wasting a lot of cpu checking for changes that haven't occurred.
0
 
LVL 2

Author Comment

by:DaveMon
ID: 2617536


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
0

Featured Post

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question