Click here to Skip to main content
15,899,313 members
Home / Discussions / C#
   

C#

 
Questionusing WinForms control from another thread Pin
peterchen6-Nov-06 13:09
peterchen6-Nov-06 13:09 
AnswerRe: using WinForms control from another thread Pin
Judah Gabriel Himango6-Nov-06 13:18
sponsorJudah Gabriel Himango6-Nov-06 13:18 
GeneralRe: using WinForms control from another thread Pin
peterchen6-Nov-06 14:33
peterchen6-Nov-06 14:33 
GeneralRe: using WinForms control from another thread Pin
Judah Gabriel Himango6-Nov-06 15:50
sponsorJudah Gabriel Himango6-Nov-06 15:50 
Questiontesting for a bit in an enum Pin
peterchen6-Nov-06 13:03
peterchen6-Nov-06 13:03 
AnswerRe: testing for a bit in an enum Pin
Luc Pattyn6-Nov-06 13:35
sitebuilderLuc Pattyn6-Nov-06 13:35 
GeneralRe: testing for a bit in an enum Pin
peterchen6-Nov-06 13:44
peterchen6-Nov-06 13:44 
AnswerRe: testing for a bit in an enum Pin
Scott Dorman8-Nov-06 7:43
professionalScott Dorman8-Nov-06 7:43 
The enum really should have the [Flags] attribute, which tells the compiler that all of the values are supposed to be unique and provides a few other subtle runtime differences.

The best way to test to see if a particular value has been set is:

C#
// Using FileInfo and FileAttributes as an example
FileInfo info = new FileInfo(@"c:\windows\explorer.exe");
 
// Test to see if the file is read-only
if ((info.Attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
{
   // more code here...
}
else
{
   // file isn't read-only...other code here...
}
.NET does allow you to treat an enum without the [Flags] attribute as if it were a flags enum to some extent, but it isn't recommended. If at some point the language or the compiler rules change, using an enum in this way without the [Flags] attribute could generate a compiler warning or error.

-----------------------------
In just two days, tomorrow will be yesterday.

QuestiondataGrid and textBox Pin
aPerfectCircle6-Nov-06 12:39
aPerfectCircle6-Nov-06 12:39 
AnswerRe: dataGrid and textBox Pin
freshonlineMax6-Nov-06 18:15
freshonlineMax6-Nov-06 18:15 
AnswerRe: dataGrid and textBox Pin
mkc2k36-Nov-06 18:17
mkc2k36-Nov-06 18:17 
AnswerRe: dataGrid and textBox Pin
aPerfectCircle7-Nov-06 13:43
aPerfectCircle7-Nov-06 13:43 
Questionhow to set password on Sqlserver 2005 database ? Pin
hdv2126-Nov-06 10:09
hdv2126-Nov-06 10:09 
AnswerRe: how to set password on Sqlserver 2005 database ? Pin
freshonlineMax6-Nov-06 18:34
freshonlineMax6-Nov-06 18:34 
Questionchess info Pin
raonasir6-Nov-06 8:57
raonasir6-Nov-06 8:57 
AnswerRe: chess info Pin
Guffa6-Nov-06 9:00
Guffa6-Nov-06 9:00 
GeneralRe: chess info Pin
Christian Graus6-Nov-06 10:25
protectorChristian Graus6-Nov-06 10:25 
QuestionAre Settings variables thread safe ? Pin
Nadia Monalisa6-Nov-06 8:48
Nadia Monalisa6-Nov-06 8:48 
AnswerRe: Are Settings variables thread safe ? Pin
Judah Gabriel Himango6-Nov-06 9:46
sponsorJudah Gabriel Himango6-Nov-06 9:46 
GeneralRe: Are Settings variables thread safe ? Pin
Nadia Monalisa6-Nov-06 9:51
Nadia Monalisa6-Nov-06 9:51 
QuestionHow to parse database address Pin
AndrusM6-Nov-06 7:00
AndrusM6-Nov-06 7:00 
AnswerRe: How to parse database address Pin
Judah Gabriel Himango6-Nov-06 9:48
sponsorJudah Gabriel Himango6-Nov-06 9:48 
QuestionPOS application Pin
Harikrk6-Nov-06 6:56
Harikrk6-Nov-06 6:56 
AnswerRe: POS application Pin
ednrgc6-Nov-06 9:14
ednrgc6-Nov-06 9:14 
GeneralRe: POS application Pin
Dan Neely6-Nov-06 10:03
Dan Neely6-Nov-06 10:03 

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.