Cannot refresh the textbox.text

  • Thread starter Thread starter Agnes
  • Start date Start date
A

Agnes

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
.....................
 
I take it the function is long and processor intensive?

Try Application.Doevents before the CalCompany function.

Chris
 
Agnes,

Beside the answer from Chris can you try as well when the form is already on
the screen.

\\\\
me.txtReportId.show
////

I hope this helps?

Cor
 
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top