|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Checked Listbox?Hi, all.
I have a requirement for one of my programs to have a "Checked Listbox" that contains a list of all my local/remote drives. I woudl like users to click one or more drives that I need to search for particular files. Can anyone tell me how to implement this in .NET 2.0 using VB or C#? I also need to know how to iterate thru the listbox to determine what items are selected and extract there value property. Thank you -- "dm1608" <dm1608@spam.net> schrieb: Check out the CheckedListBox control.> I have a requirement for one of my programs to have a "Checked Listbox" > that contains a list of all my local/remote drives. -- M S Herfried K. Wagner M V P <URL:http://dotnet.mvps.org/> V B <URL:http://classicvb.org/petition/> checked list box control or listview control with checkboxes enabled
Show quoteHide quote "dm1608" <dm1608@spam.net> wrote in message news:OnuAI$neGHA.3572@TK2MSFTNGP03.phx.gbl... > Hi, all. > > I have a requirement for one of my programs to have a "Checked Listbox" > that contains a list of all my local/remote drives. > > I woudl like users to click one or more drives that I need to search for > particular files. > > Can anyone tell me how to implement this in .NET 2.0 using VB or C#? > > I also need to know how to iterate thru the listbox to determine what > items are selected and extract there value property. > > Thank you -- > > > I'd use a FileOpenDialog rather than a list box, it allows the user to drill
down and select exactly what they want, saving them time. .... and how could you list "remote drives", if you mean mapped drives that's one thing, but otherwise how can you know what drives are available -- the FileOpenDialog would allow the user to select a drive on another machine which your application wouldn't know about otherwise. I think you're reinventing the wheel. Show quoteHide quote > I have a requirement for one of my programs to have a "Checked Listbox" that > contains a list of all my local/remote drives. > > I woudl like users to click one or more drives that I need to search for > particular files. Yeah, but I need them to be able to select multiple drive letters so my
application can scan for the relevent information. I'm not sure how to use the Checked Listbox control and how to iterate thru it Show quoteHide quote "PIEBALD" <PIEB***@discussions.microsoft.com> wrote in message news:2694E3E5-0857-4C12-8192-BA01957203A2@microsoft.com... > I'd use a FileOpenDialog rather than a list box, it allows the user to > drill > down and select exactly what they want, saving them time. > > ... and how could you list "remote drives", if you mean mapped drives > that's > one thing, but otherwise how can you know what drives are available -- the > FileOpenDialog would allow the user to select a drive on another machine > which your application wouldn't know about otherwise. > > I think you're reinventing the wheel. > >> I have a requirement for one of my programs to have a "Checked Listbox" >> that >> contains a list of all my local/remote drives. >> >> I woudl like users to click one or more drives that I need to search for >> particular files. > Which they can do with a FileOpenDialog, they can even select multiple
individual files. > Which they can do with a FileOpenDialog, they can even select multiple OK, I'm wrong again -- you can't use it to select directories :( I wish it > individual files. could, seems like some lacking functionality. But my basic point is still valid, I would use an OpenFileDialog to allow the user to select exactly which files to use. And consider this: if your application doesn't want to allow the user to know what files are in use then I don't know why they should know and select _where_ they are either. How about a FolderBrowserDialog? Although it doesn't seem to allow selection
of multiple directories :( Thanks -- but I think I really want them to select drives and not even have
the ability to select folders. Drives are really all I need. I.E., they want to search C: drive and D: drive. Then they'd select both. Otherwise, they would select C: only or whatever. Show quoteHide quote "PIEBALD" <PIEB***@discussions.microsoft.com> wrote in message news:A9661C38-A6FA-4BE7-A153-6BE6260B7542@microsoft.com... > How about a FolderBrowserDialog? Although it doesn't seem to allow > selection > of multiple directories :( > > In article <eOjYzQweGHA.1***@TK2MSFTNGP03.phx.gbl>, dm1608@spam.net
says... > Thanks -- but I think I really want them to select drives and not even have Checkout the DriveInfo class (new in .NET 2.0).> the ability to select folders. > > Drives are really all I need. I.E., they want to search C: drive and D: > drive. Then they'd select both. Otherwise, they would select C: only or > whatever. > > ... It fairly straight forward. To load the box you add to the Items list and
include it the item is checked by default or not. The code looks like this clbVendorShows.Items.Add("E:", False) You will need to get a list of all the drives in the system and customize the statement with what you want it to list. You will have one of theses statements for each item in the checkedlistbox. Note: If you want to reselect an item, the use; clbVendorShows.Items.Add("C:", True) To read back you use isChecked = clbVendorShows.GetItemChecked(i) where i is the index into the items. Here's some code I just used to step through all the items in the box to see if they where checked. For i = 0 To clbVendorShows.Items.Count - 1 isChecked = clbVendorShows.GetItemChecked(i) ' do some other things here based on what I found ... Next There are other ways to reach what is checked, in my case I needed to know what was check and what wasn't. Read up on the documentation in VS, on the collections available. There is one for "checked" items that will return all the items that were checked. That would be handy for when you just care about what was selected and not what wasn't selected. Bernie Show quoteHide quote "dm1608" <dm1608@spam.net> wrote in news:OMLFlfpeGHA.4912@TK2MSFTNGP05.phx.gbl: > I'm not sure how to use the Checked Listbox control and how to iterate > thru it
retrieve rows from datagridview into a separate datatable?
Moving Splitter Throws Exception Obscure Text in Textbox how to add a reference in asp.net/vb.net? MDI Simple Question about two forms Form getting maximize PictureBox with shortcut possible? Cannot fully access My namespace facility in VS 2005 How to use PDF file for online help from VB.Net windows app |
|||||||||||||||||||||||