473,569 Members | 2,770 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

suspicious delay when changing textbox properties??

Hi all,

I'm developing a Visual Basic 2005 application to communicate with an
I2C device. I recently decided to add an i2c status bar. The status
bar is just a textbox with the following properties:

When I2C communication active:
Public Sub i2c_active()
statusBar.Text = "Exchanging Data..."
statusBar.BackC olor = Drawing.Color.R ed
End Sub

When I2C communication is idle:
Public Sub i2c_idle()
statusBar.Text = "IDLE"
statusBar.BackC olor = Drawing.Color.L ime
End Sub

Ideally, the above properties are changed before and after the
get_i2c_data function. For example:
i2c_active()
get_i2c_data()
i2c_idle()

The problem is that the textbox properties for i2c_active() don't
change until after the get_i2c_data() function finishes. For example,
if I execute
i2c_active()
get_i2c_data()
the textbox doesn't turn red and display "Executing Data..." until
after it has already retrieved the data from the i2c device. This is
completely pointless!

There is some sort of delay between when the i2c_active() function
executes and when I see the textbox properties change. To debug, I
tried just executing the i2c_active() function and the textbox
properties change instantaneously . I need to have the textbox
properties change instantaneously when the get_i2c_data() function is
included. I'm not sure how to get this working. Any suggestions
would be appreciated.

Thanks,
-weg22

Aug 30 '07 #1
4 1639
On Aug 30, 8:24 am, we...@drexel.ed u wrote:
Hi all,

I'm developing a Visual Basic 2005 application to communicate with an
I2C device. I recently decided to add an i2c status bar. The status
bar is just a textbox with the following properties:

When I2C communication active:
Public Sub i2c_active()
statusBar.Text = "Exchanging Data..."
statusBar.BackC olor = Drawing.Color.R ed
End Sub

When I2C communication is idle:
Public Sub i2c_idle()
statusBar.Text = "IDLE"
statusBar.BackC olor = Drawing.Color.L ime
End Sub

Ideally, the above properties are changed before and after the
get_i2c_data function. For example:
i2c_active()
get_i2c_data()
i2c_idle()

The problem is that the textbox properties for i2c_active() don't
change until after the get_i2c_data() function finishes. For example,
if I execute
i2c_active()
get_i2c_data()
the textbox doesn't turn red and display "Executing Data..." until
after it has already retrieved the data from the i2c device. This is
completely pointless!

There is some sort of delay between when the i2c_active() function
executes and when I see the textbox properties change. To debug, I
tried just executing the i2c_active() function and the textbox
properties change instantaneously . I need to have the textbox
properties change instantaneously when the get_i2c_data() function is
included. I'm not sure how to get this working. Any suggestions
would be appreciated.
More than likely, the i2c_data method is blocking the UI thread so it
cannot process messages. One quick solution would be to add
statusBar.Refre sh() after you change the text and color.

If that doesn't work, you may wish to move the processing of the
i2c_data code to a separate thread.

Chris

Aug 30 '07 #2
Although the "active()" function modifies the properties of the text box, it
won't get repainted until the function has exited and windows pumps its
message queue. You could try using the Refresh () method to force a paint
immediately after active().
Aug 30 '07 #3
<we***@drexel.e duwrote in message
news:11******** **************@ q5g2000prf.goog legroups.com...
Hi all,

I'm developing a Visual Basic 2005 application to communicate with an
I2C device. I recently decided to add an i2c status bar. The status
bar is just a textbox with the following properties:

When I2C communication active:
Public Sub i2c_active()
statusBar.Text = "Exchanging Data..."
statusBar.BackC olor = Drawing.Color.R ed
End Sub

When I2C communication is idle:
Public Sub i2c_idle()
statusBar.Text = "IDLE"
statusBar.BackC olor = Drawing.Color.L ime
End Sub

Ideally, the above properties are changed before and after the
get_i2c_data function. For example:
i2c_active()
get_i2c_data()
i2c_idle()

The problem is that the textbox properties for i2c_active() don't
change until after the get_i2c_data() function finishes. For example,
if I execute
i2c_active()
get_i2c_data()
the textbox doesn't turn red and display "Executing Data..." until
after it has already retrieved the data from the i2c device. This is
completely pointless!

There is some sort of delay between when the i2c_active() function
executes and when I see the textbox properties change. To debug, I
tried just executing the i2c_active() function and the textbox
properties change instantaneously . I need to have the textbox
properties change instantaneously when the get_i2c_data() function is
included. I'm not sure how to get this working. Any suggestions
would be appreciated.

Thanks,
-weg22

Application.DoE vents() inserted between the calls should update the textbox
prior to entering the second subroutine (If we are talking the same
language - I get confused over variations:)

--
regards,
Les Hay, Livingston, Scotland

Aug 30 '07 #4
statusBar.Refre sh() worked!!! Thank you very much.
Aug 30 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
5542
by: lucifer | last post by:
hi i need to insert delay in my program what function should i use the old delay is not supported by the VC6
4
2430
by: Tony W | last post by:
Hi, I am trying to write a simple application to retrieve data from the Windows registry and insert it into textboxs on a windows form. So far I have one namespace containing two classess. The first class handles the form generation - (this was done using GUI form designer).
4
2515
by: Jeremy S | last post by:
I have written an ASP.NET application that performs very well. I make heavy use of the Cache and otherwise minimize the number of round trips to to the db. I couldn't be happier with the performance - except when the application first starts. When hitting my Web server over the Internet there is a delay waiting for the first page. I suspect...
2
4428
by: Uveper | last post by:
I am trying to create a textbox which would have a delayed input from keyboard. For example when I press "A" it waits for 200 ms and only after that time it passes the key to textbox. I tryed to do it with ProcessCmdKey event which fires every time any key is pressed, but there are arguments that do not contain information about the character...
2
1479
by: Peter Rilling | last post by:
I have controls on a page such as a textbox where I would like the font to match the rest of the page. The CSS style applied to the <body> tag does not seem to be used by the textbox. Can the textbox font be changed? Also, same thing for buttons.
2
3040
by: WhatHappend | last post by:
I have converted a .Net 1.0 application to .Net 2.0 and the web service invocations have delay of around 10seconds on each intial access. After the first access subsequent access are fast (After a whild of inactivity the next access will be slow agian). Changing the client to static IP address instead of DHCP makes the initial access about 1...
13
3318
by: WALDO | last post by:
I have a .Net TextBox (TextBoxBase, really) in which I am appending about 20 lines of text per second. I use the AppendText() method to accomplish this. This is a great substitute for taking the Text property and concatenating it... Me.tb.Text &= newText ' Instead use Me.tb.AppendText(newText) ....ultimately setting the SelectionStart...
10
18002
by: engteng | last post by:
When textbox properties enable = False the font in the textbox become gray color. How do I change the gray color to black color ? Regards, Tee
3
2731
Raventara
by: Raventara | last post by:
Hi all, I have a program which will routinely update the image of a picturebox and resize the picturebox to keep the aspect ratio of the image in tact. The problem I am having is that after about 10 or so changes of the image there is a really long delay in updating the image. The size properties will update but the image itself stays the same....
0
7694
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7609
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7921
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8118
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6278
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5504
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3651
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
936
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.