?
Solved

sum numbers

Posted on 2008-09-29
5
Medium Priority
?
183 Views
Last Modified: 2010-04-23
hello there,
I have this code and I would like to see the numbers increasing in the textbox from 0 to 1000 but it doesn't show that..
I only see 0 then when I click It takes a few seconds then I see 1000.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        While (txtPublic.Text < 10000)
            txtPublic.Text = txtPublic.Text + 1
        End While
    End Sub

Open in new window

0
Comment
Question by:XK8ER
[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
5 Comments
 
LVL 14

Expert Comment

by:Binuth
ID: 22603015
try this
 While (CInt(txtPublic.Text) < 10000)
            txtPublic.Text = CInt(txtPublic.Text) + 1
            System.Threading.Thread.Sleep(50)
            Application.DoEvents()
 End While

Open in new window

0
 
LVL 13

Expert Comment

by:SameerJagdale
ID: 22603029
you have to use timer component if you want to update UI.
0
 
LVL 13

Expert Comment

by:kaylanreilor
ID: 22603036
Add txtPublic.Refresh() into the while loop after calculation.
0
 
LVL 13

Accepted Solution

by:
SameerJagdale earned 2000 total points
ID: 22603039
just add            
Application.DoEvents() after the line:
txtPublic.Text = txtPublic.Text + 1

 
0
 
LVL 13

Expert Comment

by:kaylanreilor
ID: 22603114
But you don't need to process ALL the pending events in the WHOLE application at this stage ! You only need to refresh the targetted window.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

752 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