Textbox not showing contents

  • Thread starter Thread starter Harry Simpson
  • Start date Start date
H

Harry Simpson

I'm scanning data and then placing it in a textbox on a form. This was
working before and really can't figure out what changed that it's not
working now.

Try
'Slap the scan read into the first textbox
If txtPatientNumber.Text = "" Then
txtPatientNumber.Text = Me.DataGrid1.Item(e.NewIndex -
1, 0)
Exit Sub
End If

When I get to the end of the debug step through, in the immediate windows I
type:
?txtPatientNumber.text
and I get the value:
"1234567"

But it never displays in the textbox as it did before.

Any ideas what's going on?

TIA
Harry
 
Help us help you and post a small reproducible sample. At the moment I am
guessing this runs in an event handler of some sort, I can see a Try but no
catch and don't know what else has access to the txtPatientNumber.

Cheers
Daniel
 
Thanks Daniel,

It runs in the read event of the barcode scanner. You did give me a huge
clue though....maybe the fact that I'm exiting a Try with an Exit Sub is not
commiting the changes to screen.....testing that now after removing the
Try/Catch - nope that wasn't it.....

Harry
 
If the invocation of barcode scanner read event was arrived from not UI
thread it may cause some problems. Try to use UIMediator [1] (I recomend
it just for facilitation) when you want to use UI in the event handler
that is called from another thread:

barcodeClient.ReadEvent += UI.UIMediator.CreateEventHandler(this, new
EventHandler(barcodeClient_ReadEvent));

[1] http://www.sergeybogdanov.com/Samples/UIMediator.zip

Best regards,
Sergey Bogdanov
http://www.sergeybogdanov.com
 
Back
Top