"Agnes" <ag***@dynamictech.com.hk> wrote in news:ea6QYOgCFHA.3324
@TK2MSFTNGP15.phx.gbl:
Before I run a function, i will put the string in a textbox. However,
I found that the messagebox show the correct value.
BUT the textbox show nothing. Finally, after the function 's process
is completed. the value will be shown in the textbox.
How Can i correct it ?
thanks a lot
Me.txtReportId.Text = Me.pReportId
messagebox.show(Me.txtReportId.Text )
Me.CalCompany() <-- function
Me.pgbProcess.Value = 0
.....................
compare these two:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Me.TextBox1.Text = "blahblahblah"
System.Threading.Thread.Sleep(3000) 'pause for 3 seconds
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Me.TextBox2.Text = "blahblahblah"
Me.TextBox2.Update()
System.Threading.Thread.Sleep(3000) 'pause for 3 seconds
End Sub
The update in the button2_click sub updates the textbox there and then.
Otherwise the textbox isn't redrawn until the sub finishes.