Silly user feedback question...

B

Brent

I've never really done a form-based application -- I've mostly done Web
stuff -- so I have a very basic question:

How do I provide simple text feedback to the user as the program runs?

I'm envisioning some kind of Response.Write(), Response.Flush()
scenario, except that the text will go to a control on the form, rather
than back to the browser. I've tried a multiline textbox, and a label
control, but in each instance, the code has to finish executing before
anything is displayed.

I appreciate your help!

--Brent
 
A

ahager via DotNetMonster.com

messageBox.show
I've never really done a form-based application -- I've mostly done Web
stuff -- so I have a very basic question:

How do I provide simple text feedback to the user as the program runs?

I'm envisioning some kind of Response.Write(), Response.Flush()
scenario, except that the text will go to a control on the form, rather
than back to the browser. I've tried a multiline textbox, and a label
control, but in each instance, the code has to finish executing before
anything is displayed.

I appreciate your help!

--Brent
 
N

Nicholas Paldino [.NET/C# MVP]

Brent,

In this case, you will have to perform your work on another thread.
Then, as you want to update the UI, you would make calls to set the
appropriate UI elements.

Windows controls are picky about the context in which they are called,
though. Generally, anything affecting the UI has to be called from the
thread that created the UI itself. If you try and make a call to update the
text of a textbox from another thread, it won't work too well.

To get around this, you can create a delegate which matches the
signature of a method which will perform the update. You then pass this
delegate, along with any parameters to a call to Invoke on a control created
on the UI thread. It will then cause the method pointed to by the delegate
to be called on the UI thread.

Hope this helps.
 
B

Brent

Thanks, Nicholas. In that case, it's not worth the time to implement.
I've added a feedback bar, instead...

--Brent
 

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

Top