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

C#

 
Questioni want count rows per same date in new one row. c# with sqlserver Pin
Mostafa Mohamed23-Oct-19 22:06
Mostafa Mohamed23-Oct-19 22:06 
AnswerRe: i want count rows per same date in new one row. c# with sqlserver Pin
OriginalGriff23-Oct-19 22:22
mveOriginalGriff23-Oct-19 22:22 
QuestionHow do I bind TreeView Selected Item? Pin
User 1459901922-Oct-19 19:52
User 1459901922-Oct-19 19:52 
AnswerRe: How do I bind TreeView Selected Item? Pin
Mc_Topaz24-Oct-19 21:00
Mc_Topaz24-Oct-19 21:00 
QuestionWhy does the Form_Paint event run continuously and only draw once ? Pin
Member 245846722-Oct-19 15:53
Member 245846722-Oct-19 15:53 
AnswerRe: Why does the Form_Paint event run continuously and only draw once ? Pin
Dave Kreskowiak22-Oct-19 17:56
mveDave Kreskowiak22-Oct-19 17:56 
GeneralRe: Why does the Form_Paint event run continuously and only draw once ? Pin
Member 245846723-Oct-19 22:09
Member 245846723-Oct-19 22:09 
GeneralRe: Why does the Form_Paint event run continuously and only draw once ? Pin
Dave Kreskowiak24-Oct-19 4:33
mveDave Kreskowiak24-Oct-19 4:33 
The Label control was a bad idea because it changes the behavior of your code. When you set the value of the Text property, the label does not get repainted at that time. It forces the label to Invalidate itself, telling Windows that it needs to repaint. Windows will get around to posting a WM_PAINT message to the applications message queue. When the UI thread finally goes back to idle, the queue will get processed and the paint message makes it way to the label control, telling it that it is now OK to paint itself. That is when the label actually changes on screen.

Moving on, you never use the value of the Random so it's never being painted anywhere.

Form_Paint is a bit much for this. I'd create a Control specifically for the purpose. This makes the code reusable and easily maintained.

The control would have it's own Random, it's own Timer, and a couple of methods to Start and Stop it's behavior.

GeneralRe: Why does the Form_Paint event run continuously and only draw once ? Pin
Member 245846724-Oct-19 16:59
Member 245846724-Oct-19 16:59 
GeneralRe: Why does the Form_Paint event run continuously and only draw once ? Pin
Dave Kreskowiak24-Oct-19 18:04
mveDave Kreskowiak24-Oct-19 18:04 
GeneralC # Pin
Member 1461982622-Oct-19 0:45
Member 1461982622-Oct-19 0:45 
GeneralRe: C # Pin
OriginalGriff22-Oct-19 0:57
mveOriginalGriff22-Oct-19 0:57 
QuestionRe: C # Pin
ZurdoDev22-Oct-19 2:59
professionalZurdoDev22-Oct-19 2:59 
AnswerRe: C # Pin
OriginalGriff22-Oct-19 3:32
mveOriginalGriff22-Oct-19 3:32 
GeneralRe: C # Pin
ZurdoDev22-Oct-19 4:04
professionalZurdoDev22-Oct-19 4:04 
GeneralRe: C # Pin
Dave Kreskowiak22-Oct-19 6:07
mveDave Kreskowiak22-Oct-19 6:07 
GeneralRe: C # Pin
Luc Pattyn22-Oct-19 10:23
sitebuilderLuc Pattyn22-Oct-19 10:23 
GeneralRe: C # Pin
Richard Deeming23-Oct-19 1:25
mveRichard Deeming23-Oct-19 1:25 
GeneralRe: C # Pin
Luc Pattyn23-Oct-19 2:56
sitebuilderLuc Pattyn23-Oct-19 2:56 
QuestionLDAP query to ActiveDirectory being whimsical (search by custom attribute broken) Pin
Super Lloyd21-Oct-19 21:30
Super Lloyd21-Oct-19 21:30 
SuggestionRe: LDAP query to ActiveDirectory being whimsical (search by custom attribute broken) Pin
Richard MacCutchan21-Oct-19 22:41
mveRichard MacCutchan21-Oct-19 22:41 
GeneralRe: LDAP query to ActiveDirectory being whimsical (search by custom attribute broken) Pin
Super Lloyd22-Oct-19 1:07
Super Lloyd22-Oct-19 1:07 
GeneralRe: LDAP query to ActiveDirectory being whimsical (search by custom attribute broken) Pin
Richard MacCutchan22-Oct-19 1:31
mveRichard MacCutchan22-Oct-19 1:31 
Questiona WinForm ToolStripMenuItem quirk ? Pin
BillWoodruff21-Oct-19 4:26
professionalBillWoodruff21-Oct-19 4:26 
AnswerRe: a WinForm ToolStripMenuItem quirk ? Pin
Luc Pattyn21-Oct-19 9:14
sitebuilderLuc Pattyn21-Oct-19 9:14 

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.