By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,971 Members | 907 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,971 IT Pros & Developers. It's quick & easy.

Using loop in text box

P: 6
Hello I used textbox in my project i write a number and some thing writing i textbox using loop
for example
i used this code
Expand|Select|Wrap|Line Numbers
  1. Private Sub Command1_Click()
  2. Dim i As Integer
  3. For i = 0 To 10
  4. Text1.Text = "work is great" & i
  5. Next i
  6. End Sub
but when i run program and click button only see result work is great10

i run
work is great0
work is great1
work is great2
work is great3
work is great4
.
.
.
how can this work in textbox
Dec 19 '13 #1
Share this Question
Share on Google+
2 Replies


Rabbit
Expert Mod 10K+
P: 12,357
Please use code tags when posting code or formatted data.

All UI update events are suspended until code has finished running. You need to use a Timer object if you want the UI to update in between each run.
Dec 19 '13 #2

P: 11
'
'add timer control to form
'set interval to 1500 and enabled = false
Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2. Dim C
  3. Private Sub Command1_Click()
  4.     Timer1.Enabled = True
  5. '
  6. End Sub
  7.  
  8. Private Sub Timer1_Timer()
  9. '
  10.     C = C + 1
  11.        Text1 = "Work is great" & " " & C
  12.         If C >= 11 Then
  13.             Timer1.Enabled = False
  14.             Text1 = ""
  15.         End If
  16. '
  17. End Sub
  18.  
Dec 19 '13 #3

Post your reply

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