Would you mind assisting me with some code? I am new to this aspect of VB.net...and I am somewhat of a novice programmer. Thanks!
Main Topics
Browse All Topicsvb.net
I have a textbox that is changing during runtime of my program. If the text = "abcd" for 5 minutes, I want to display a new form. How do i do this? Thanks a ton!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
1) Add a timer to the form (a timer is one of the standard controls listed with buttons, check boxes, etc).
2) from design view, make sure timer.enabled is set false and the interval is 300000 (5 minutes in milliseconds)
3) add a Tick event
4) likewise, add a TextChanged event to the text box
The change event will look like:
Private Sub TextBox1_TextChanged(ByVal
If TextBox1.Text.Trim.Length = 0 Then
Timer1.Enabled = False
Timer1.Enabled = True
End If
End Sub
The timer handler:
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
' do whatever you want to do when the non-blank text has not changed in 5 minutes
End Sub
A better design will be to visually inherit the TextBox and encapsulate all the code there. My suggestion is as follows:
You can then reuse the this new control in more than one place.
You can also keep the timing configurable by creating a new read/write property in the inherited class.
You can have a public event in the inherited TextBox, that will fire at the specified interval.
The inherited class will encapsulate a Windows.Timer object member variable.
From a design perspective, this is a much better solution.
Example:
Public Class MyTextBox
Inherits TextBox
Private _timer As Windows.Forms.Timer
Public Event TextboxTimerTick(ByVal sender As Object)
Public Sub New()
MyBase.New()
_timer = New Windows.Forms.Timer
_timer.Enabled = False
AddHandler _timer.Tick, AddressOf TickHandler
End Sub
Public Property TimerInterval() As Integer
Get
Return _timer.Interval
End Get
Set(ByVal Value As Integer)
_timer.Interval = Value
End Set
End Property
Public Property TimerEnabled() As Boolean
Get
Return _timer.Enabled
End Get
Set(ByVal Value As Boolean)
_timer.Enabled = Value
End Set
End Property
Private Sub TickHandler(ByVal sender As Object, ByVal e As EventArgs)
RaiseEvent TextboxTimerTick(Me)
End Sub
End Class
Business Accounts
Answer for Membership
by: cookrePosted on 2005-05-21 at 16:59:05ID: 14053449
Add a timer to the form.
Disable the timer in FormLoad.
Whenever the text changes and is non-blank, disable, then re-enable the timer.
If the timer handler ever gets control, you'll know the non-blank text has remained unchanged for 5 minutes.
If you're really interested in a specific value (e.g., 'abcd'), just check for that value in the timer handler.