473,386 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Textbox update every frame?

In VBA:

Is there a way to get 'tie' a textbox to a variable such that every time the variable updates, the change is reflected in the textbox? If that isn't possible, then it would be acceptable to have a routine run every so often (100 ms, let's say) that would set the textbox to the variable.
Sep 3 '07 #1
3 2225
kadghar
1,295 Expert 1GB
In VBA:

Is there a way to get 'tie' a textbox to a variable such that every time the variable updates, the change is reflected in the textbox? If that isn't possible, then it would be acceptable to have a routine run every so often (100 ms, let's say) that would set the textbox to the variable.
I dont know if you can "tie" the variable to the text box, i recomend you to add an extra line after each procedure where you set the value to the text box.

I dont know neither how to use Timers in VBA, but you can write this lines in the sub UserForm_Activate

Do
TextBox1.Text = Variable1
DoEvents
Loop

But i dont like this method very much since it could slow down things (just a little bit)
hope this helps
Sep 3 '07 #2
Killer42
8,435 Expert 8TB
Yes, I seem to recall timers are something of a problem in VBA. I think you have to use the OnTime function to get something equivalent. To quote the remarks in the doco from Excel...
Use Now + TimeValue(time) to schedule something to be run when a specific amount of time (counting from now) has elapsed. Use TimeValue(time) to schedule something to be run a specific time.
Sep 4 '07 #3
Yes, I seem to recall timers are something of a problem in VBA. I think you have to use the OnTime function to get something equivalent. To quote the remarks in the doco from Excel...
Use Now + TimeValue(time) to schedule something to be run when a specific amount of time (counting from now) has elapsed. Use TimeValue(time) to schedule something to be run a specific time.
Well... The limit of the ontime function is 1 second, which doesn't really work for me. Googling for the OnTime function, however, led me to the Windows API calls for setting and stopping timers. This works great. Updating 10 times a second appears realtime, yet doesn't tax the system.

Strangely, I can update the UI directly from the callback function that the timer uses, but I can't do it from a callback function from a COM object. Obnoxious.


Thank you for the help!

- Matt
Sep 4 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Valiz | last post by:
Hi, I am updating system time with IRIG time source which sends irregular pulses as shown below 11000011111100111111111111111111....(1-IRIG present and 0-IRIG not present) I need to update...
6
by: Alex | last post by:
I am a newbie to ASP.NET... What I was trying to do... but yet to succeed in... I am building a customer info database... and on default, I want to display the customer's basic information in...
2
by: JAW | last post by:
I have posted this in a couple of the other newsgropus but have not recieved any responses. Thought I would try it here. I have a frameset that contains frames (top and bottom). In the bottopm...
1
by: VB Programmer | last post by:
With HTML, how do I get the value of a textbox in an ItemTemplate column within a datagrid? Simple shopping cart. For each row: 1 column is a textbox where they can enter the quantity. 1...
6
by: JohnR | last post by:
I have a table with 1 row which is used to hold some application wide items (one item per field, hence I only need 1 row). I want to bind one of the fields to a textbox. After setting up the...
2
by: Yogi_Bear_79 | last post by:
I have a script that parses window.location.hash to figure out which xml file to load. The xml files populate a page on a framed site. The code works correctly to a point. If I have a seperate...
1
by: AssOnFire | last post by:
Hello, I have bound a textbox to a CustomerName column of my DB, using the data binding property, and selected it from the DataTable. when i change the text in the texbBox, i try to update the...
2
by: stefaan | last post by:
Hi all, I have a CEdit window in my application which I use as a sort of output console for text generated by my program. Each subsection writes to its own string buffer and every 2 seconds I...
9
by: Phill W. | last post by:
VB.Net 2005 SP1 Windows Forms Application What's the fastest way to append text to a TextBox? I have an application that monitors data written to text files. It needs to scan some fairly...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.