Click here to Skip to main content
16,004,574 members
Home / Discussions / C#
   

C#

 
AnswerRe: multi tcp clients Pin
OriginalGriff2-Jul-24 21:37
mveOriginalGriff2-Jul-24 21:37 
GeneralRe: multi tcp clients Pin
darinka3-Jul-24 2:05
darinka3-Jul-24 2:05 
AnswerRe: multi tcp clients Pin
jschell3-Jul-24 6:14
jschell3-Jul-24 6:14 
GeneralRe: multi tcp clients Pin
darinka3-Jul-24 6:59
darinka3-Jul-24 6:59 
QuestionHow I write this logic to check if string in a list and also checked ? Pin
Martin Adams 202326-Jun-24 13:07
Martin Adams 202326-Jun-24 13:07 
AnswerRe: How I write this logic to check if string in a list and also checked ? Pin
OriginalGriff26-Jun-24 18:24
mveOriginalGriff26-Jun-24 18:24 
GeneralRe: How I write this logic to check if string in a list and also checked ? Pin
Martin Adams 202327-Jun-24 1:46
Martin Adams 202327-Jun-24 1:46 
AnswerRe: How I write this logic to check if string in a list and also checked ? Pin
Richard Deeming27-Jun-24 2:35
mveRichard Deeming27-Jun-24 2:35 
As you have discovered, drive not in chklist_drives.CheckedItems is not valid C#.

Assuming this is a Windows Forms CheckedListBox control, the CheckedItems collection provides a Contains method to test whether an item is in the collection:
CheckedListBox.CheckedItemCollection.Contains(Object) Method (System.Windows.Forms) | Microsoft Learn[^]

But you're also going to find that foreach (drive in all drives) is not valid C# either. Perhaps you're looking for the System.IO.DriveInfo.GetDrives method[^]?
C#
foreach (DriveInfo drive in DriveInfo.GetDrives())
{
    if (!drive.IsReady) continue;
    if (!chklist_drives.CheckedItems.Contains(drive.Name)) continue;
    
    ...
}
You'll need to adjust that code so that the value you check for in the list matches the value you added to the list in the first place.



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

GeneralRe: How I write this logic to check if string in a list and also checked ? Pin
Martin Adams 202327-Jun-24 2:46
Martin Adams 202327-Jun-24 2:46 
GeneralRe: How I write this logic to check if string in a list and also checked ? Pin
OriginalGriff27-Jun-24 3:55
mveOriginalGriff27-Jun-24 3:55 
QuestionProject structure with C# and EfCore Pin
nwbkn20-Jun-24 4:54
nwbkn20-Jun-24 4:54 
AnswerRe: Project structure with C# and EfCore Pin
jschell20-Jun-24 12:41
jschell20-Jun-24 12:41 
GeneralRe: Project structure with C# and EfCore Pin
nwbkn21-Jun-24 6:35
nwbkn21-Jun-24 6:35 
GeneralRe: Project structure with C# and EfCore Pin
Richard Andrew x6423-Jun-24 4:58
professionalRichard Andrew x6423-Jun-24 4:58 
GeneralRe: Project structure with C# and EfCore Pin
Waqas Khan 202427-Jun-24 2:22
Waqas Khan 202427-Jun-24 2:22 
QuestionC# Newbie, Database Programming Pin
JasonParker33320-Jun-24 2:03
JasonParker33320-Jun-24 2:03 
AnswerRe: C# Newbie, Database Programming Pin
OriginalGriff20-Jun-24 2:09
mveOriginalGriff20-Jun-24 2:09 
GeneralRe: C# Newbie, Database Programming Pin
JasonParker33320-Jun-24 3:18
JasonParker33320-Jun-24 3:18 
GeneralRe: C# Newbie, Database Programming Pin
OriginalGriff20-Jun-24 4:36
mveOriginalGriff20-Jun-24 4:36 
AnswerRe: C# Newbie, Database Programming Pin
Richard MacCutchan24-Jun-24 6:12
mveRichard MacCutchan24-Jun-24 6:12 
GeneralRe: C# Newbie, Database Programming Pin
JasonParker33324-Jun-24 6:18
JasonParker33324-Jun-24 6:18 
GeneralRe: C# Newbie, Database Programming Pin
trønderen24-Jun-24 7:18
trønderen24-Jun-24 7:18 
GeneralRe: C# Newbie, Database Programming Pin
Richard MacCutchan24-Jun-24 7:50
mveRichard MacCutchan24-Jun-24 7:50 
GeneralRe: C# Newbie, Database Programming Pin
trønderen24-Jun-24 8:08
trønderen24-Jun-24 8:08 
GeneralRe: C# Newbie, Database Programming Pin
Richard MacCutchan24-Jun-24 9:33
mveRichard MacCutchan24-Jun-24 9:33 

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.