Click here to Skip to main content
14,387,739 members
   

C#

 
GeneralRe: add code text to speech voices windows 7 ? Pin
Member 245846720-Nov-19 16:45
MemberMember 245846720-Nov-19 16:45 
GeneralRe: add code text to speech voices windows 7 ? Pin
Pete O'Hanlon20-Nov-19 22:47
mvePete O'Hanlon20-Nov-19 22:47 
GeneralRe: add code text to speech voices windows 7 ? Pin
Member 245846724-Nov-19 16:06
MemberMember 245846724-Nov-19 16:06 
QuestionC# How to show my List of data in Pivot format Pin
Mou_kol16-Nov-19 9:17
MemberMou_kol16-Nov-19 9:17 
QuestionRe: C# How to show my List of data in Pivot format Pin
Eddy Vluggen16-Nov-19 10:30
mveEddy Vluggen16-Nov-19 10:30 
AnswerRe: C# How to show my List of data in Pivot format Pin
Richard Deeming17-Nov-19 23:57
mveRichard Deeming17-Nov-19 23:57 
Questionprint statements within a method is not displaying on Rich text box in c# windows form Pin
Member 1465244915-Nov-19 19:35
MemberMember 1465244915-Nov-19 19:35 
AnswerRe: print statements within a method is not displaying on Rich text box in c# windows form Pin
OriginalGriff15-Nov-19 20:57
mveOriginalGriff15-Nov-19 20:57 
No, they won't. And there are loads of reasons why not.
Firstly, you set the RTB Text each time - which discards any text in it already, so only the last text will ever be displayed.
Secondly, this is code that runs on the UI thread - if it didn't, you would get a "Cross-threading exception" when you set the Text property - so it blocks the thread which is in charge of changing the display which means that the RTB content can't be drawn until your method exits.
Thirdly, you are waiting for serial input data, which blocks the method from doing anything else - and that further blocks the UI thread.

What you need to do is move that code into a separate thread and receive updates from the thread to display data in your UI thread.
I'd suggest a BackgroundWorker Class (System.ComponentModel) | Microsoft Docs[^] - it's easy to use and provides progress reporting back to the UI thread via an Event which you can use to update your RTB as it goes along.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
AntiTwitter: @DalekDave is now a follower!


modified 16-Nov-19 2:13am.

GeneralRe: print statements within a method is not displaying on Rich text box in c# windows form Pin
Member 1465244915-Nov-19 23:30
MemberMember 1465244915-Nov-19 23:30 
GeneralRe: print statements within a method is not displaying on Rich text box in c# windows form Pin
OriginalGriff15-Nov-19 23:48
mveOriginalGriff15-Nov-19 23:48 
QuestionGetValueOrDefault() Throws Pin
Kevin Marois15-Nov-19 7:35
professionalKevin Marois15-Nov-19 7:35 
AnswerRe: GetValueOrDefault() Throws Pin
Eddy Vluggen15-Nov-19 7:50
mveEddy Vluggen15-Nov-19 7:50 
GeneralRe: GetValueOrDefault() Throws Pin
Kevin Marois15-Nov-19 9:09
professionalKevin Marois15-Nov-19 9:09 
GeneralRe: GetValueOrDefault() Throws Pin
Eddy Vluggen15-Nov-19 10:16
mveEddy Vluggen15-Nov-19 10:16 
GeneralRe: GetValueOrDefault() Throws Pin
Kevin Marois15-Nov-19 10:23
professionalKevin Marois15-Nov-19 10:23 
GeneralRe: GetValueOrDefault() Throws Pin
Eddy Vluggen16-Nov-19 1:31
mveEddy Vluggen16-Nov-19 1:31 
QuestionRe: GetValueOrDefault() Throws Pin
Eddy Vluggen17-Nov-19 1:34
mveEddy Vluggen17-Nov-19 1:34 
AnswerRe: GetValueOrDefault() Throws Pin
Richard Deeming17-Nov-19 23:53
mveRichard Deeming17-Nov-19 23:53 
GeneralRe: GetValueOrDefault() Throws Pin
Kevin Marois18-Nov-19 9:40
professionalKevin Marois18-Nov-19 9:40 
GeneralRe: GetValueOrDefault() Throws Pin
Richard Deeming18-Nov-19 9:48
mveRichard Deeming18-Nov-19 9:48 
GeneralRe: GetValueOrDefault() Throws Pin
Kevin Marois18-Nov-19 9:54
professionalKevin Marois18-Nov-19 9:54 
GeneralRe: GetValueOrDefault() Throws Pin
Richard Deeming18-Nov-19 10:00
mveRichard Deeming18-Nov-19 10:00 
GeneralRe: GetValueOrDefault() Throws Pin
Kevin Marois18-Nov-19 10:02
professionalKevin Marois18-Nov-19 10:02 
GeneralRe: GetValueOrDefault() Throws Pin
Richard Deeming18-Nov-19 10:04
mveRichard Deeming18-Nov-19 10:04 
GeneralRe: GetValueOrDefault() Throws Pin
Kevin Marois18-Nov-19 10:24
professionalKevin Marois18-Nov-19 10:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.