Click here to Skip to main content
15,902,299 members
Home / Discussions / C#
   

C#

 
QuestionMissing data on Windows App form C# Pin
Member 131317266-Jun-17 23:33
Member 131317266-Jun-17 23:33 
AnswerRe: Missing data on Windows App form C# Pin
Jochen Arndt7-Jun-17 1:46
professionalJochen Arndt7-Jun-17 1:46 
GeneralRe: Missing data on Windows App form C# Pin
Member 131317267-Jun-17 2:47
Member 131317267-Jun-17 2:47 
GeneralRe: Missing data on Windows App form C# Pin
Gerry Schmitz7-Jun-17 3:16
mveGerry Schmitz7-Jun-17 3:16 
GeneralRe: Missing data on Windows App form C# Pin
Jochen Arndt7-Jun-17 3:26
professionalJochen Arndt7-Jun-17 3:26 
AnswerRe: Missing data on Windows App form C# Pin
Luc Pattyn8-Jun-17 13:44
sitebuilderLuc Pattyn8-Jun-17 13:44 
GeneralRe: Missing data on Windows App form C# Pin
Member 1313172611-Jun-17 20:41
Member 1313172611-Jun-17 20:41 
GeneralRe: Missing data on Windows App form C# Pin
Luc Pattyn12-Jun-17 6:15
sitebuilderLuc Pattyn12-Jun-17 6:15 
Hi again,

1. There is no such thing as "calling a thread". Every thread is running all the time, provided it isn't blocked and sufficient CPU resources are available. Thread code often consists of one big loop performing some calculations and then either waiting (=being blocked on some object, say a WaitHandle) or just testing for more work (=polling). When polling, make sure not to have it spin all the time, which means when no job is available, block it for at least a fraction of a second (e.g. with a Thread.Sleep). Best is to use an event-driven approach though.

2. A WinForms Control will try and repaint itself as soon as there is a need for that, e.g. when you scroll it, your code adds/modifies data to it, etc. You can request a repaint by calling its Invalidate() method, which does not guarantee an immediate repaint, it merely queues a request. If you insist on having a periodic repaint, just use a Windows.Forms.Timer and in its Tick handler just do myDGV.Invalidate(); However, a list Control that gets an item added does not need an explicit Invalidate, it will know a repaint is required all by itself.

3. A DataGridView is a complex and expensive Control, that may require a lot of CPU cycles. If all you need is a way to look at some data, without lots of user interaction, sorting, and the like, I would recommend you use a ListBox instead. And assuming you'll have hundreds of items in it, I would suggest you make it hold your byte arrays, not strings; ListBoxes indeed hold items, not just strings, and allocate a rectangular area for displaying each of those items. If you make it userdrawn (myLB.DrawMode = DrawMode.OwnerDrawFixed;), and provide a DrawItem handler, you can actually paint whatever you want it to paint inside its rectangle; that allows you to create very inexpensive columns and backgrounds. Finally setting myLB.TopIndex=myLB.Items.Count-1; each time you add an item to it will ensure your ListBox keeps scrolling up automatically.

The nice thing about this approach is you only spend CPU resources to rows that are actually visible, all rows that are off-screen or otherwise invisible will not have their DrawItem event firing.

If all this is new to you, I suggest you read up on ListBox, and maybe this could be a good example.

Smile | :)
Luc Pattyn [My Articles] Nil Volentibus Arduum

GeneralRe: Missing data on Windows App form C# Pin
Member 1313172612-Jun-17 20:39
Member 1313172612-Jun-17 20:39 
GeneralRe: Missing data on Windows App form C# Pin
Luc Pattyn12-Jun-17 23:42
sitebuilderLuc Pattyn12-Jun-17 23:42 
QuestionJson parser error when converting iphone images from bytes to base64 string in a MVC JsonResult Pin
jkirkerx6-Jun-17 10:22
professionaljkirkerx6-Jun-17 10:22 
AnswerRe: Json parser error when converting iphone images from bytes to base64 string in a MVC JsonResult [solved] Pin
jkirkerx6-Jun-17 12:49
professionaljkirkerx6-Jun-17 12:49 
SuggestionRe: Json parser error when converting iphone images from bytes to base64 string in a MVC JsonResult [solved] Pin
Richard Deeming7-Jun-17 0:57
mveRichard Deeming7-Jun-17 0:57 
GeneralRe: Json parser error when converting iphone images from bytes to base64 string in a MVC JsonResult [solved] Pin
jkirkerx7-Jun-17 6:33
professionaljkirkerx7-Jun-17 6:33 
QuestionCreate a chart in PowerPoint using C#. Pin
Member 126813284-Jun-17 22:30
Member 126813284-Jun-17 22:30 
AnswerRe: Create a chart in PowerPoint using C#. Pin
OriginalGriff4-Jun-17 22:43
mveOriginalGriff4-Jun-17 22:43 
Questioncustom controls not binding wpf Pin
Member 112967764-Jun-17 7:52
Member 112967764-Jun-17 7:52 
AnswerRe: custom controls not binding wpf Pin
Gerry Schmitz5-Jun-17 5:36
mveGerry Schmitz5-Jun-17 5:36 
GeneralRe: custom controls not binding wpf Pin
Member 112967765-Jun-17 18:30
Member 112967765-Jun-17 18:30 
QuestionConfigure Remote Machine's IP in C# Service At Install Time Pin
Django_Untaken3-Jun-17 22:58
Django_Untaken3-Jun-17 22:58 
AnswerRe: Configure Remote Machine's IP in C# Service At Install Time Pin
Eddy Vluggen4-Jun-17 2:55
professionalEddy Vluggen4-Jun-17 2:55 
AnswerRe: Configure Remote Machine's IP in C# Service At Install Time Pin
Gerry Schmitz4-Jun-17 4:45
mveGerry Schmitz4-Jun-17 4:45 
QuestionReport cant be display on report viewer page in c#.net windows form Pin
Member 132383512-Jun-17 22:31
Member 132383512-Jun-17 22:31 
AnswerRe: Report cant be display on report viewer page in c#.net windows form Pin
User 41802543-Jun-17 3:32
User 41802543-Jun-17 3:32 
QuestionHow to solve 2 js script file crash problem Pin
Member 130563031-Jun-17 16:22
Member 130563031-Jun-17 16:22 

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.