This is the code that I used to fill the CheckedListBox:

AffectedDirectory = New System.IO.DirectoryInfo(Me.TB_DirName.Text)
FileList = AffectedDirectory.GetFiles(Me.TB_FileFilter.Text)
CheckedListBox1.Items.AddRange(FileList)


Also, are there any good reference books for Visual Basic?

________________________________

From: Daniel Magliola [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 10, 2004 11:45 AM
To: [EMAIL PROTECTED]
Subject: RE: [-vb] File manipulation


Charles,
 
DirectoryInfo.GetFiles will return an array of FileInfo, so that will
work fine.
 
For the CheckedListbox, first i'd say what you want to get is not the
SelectedItems property, which will return all the selected entries (ie,
painted blue), but the CheckedItems property, which will return the
checked entries.
 
Either of these two, however, will return a collection to you. The
objects in this collection will be of whichever type were the objects
you added to the Items Collection.
You will have to somehow convert this collection to a FileInfo array, in
order to assign it to FileList().
 
If what you added to the CheckedListbox where FileInfo objects in the
first place, you might be able to use the CopyTo method of the
collection, together with a CType, or a DirectCast, and avoid looping
through the collection.
 
I'd also recommend you turn on Option Strict On for all your projects,
since it will make it easier for you to find errors while coding,
instead of waiting until test-time.
 
If you give us more information, (like showing us the code you use to
fill the CheckedListbox, for example), we'll be able to help you more.
 
Hope this helps
Daniel
 

        -----Mensaje original-----
        De: Charles Parks [mailto:[EMAIL PROTECTED]
        Enviado el: Friday, September 10, 2004 13:24
        Asunto: [-vb] File manipulation
        
        
        I am having trouble loading a variable with correct values.
        
        If my checkbox is unchecked it will load with the correct values
but if
        it is checked then it will not load the correct values.
CheckedListBox1
        contains the names of filenames.
        
        Dim AffectedDirectory As System.IO.DirectoryInfo
        Dim FileList() As System.IO.FileInfo
        
                   If CB_Verify.Checked = False Then
                        FileList =
        AffectedDirectory.GetFiles(Me.TB_FileFilter.Text)
                    Else
                        FileList = (CheckedListBox1.SelectedItems)
        <<<<<<<<<<<This line is not working
                    End If
        
        What should I be looking for?
        
        
        /-------------------------------------\
        |      Visual Basic Programmming      |
        \-------------------------------------/ 
        
        
        
        
        /-------------------------------------\
        |      Visual Basic Programmming      |
        \-------------------------------------/ 
        
        
        
        Yahoo! Groups Sponsor   
                ADVERTISEMENT
        click here
<http://us.ard.yahoo.com/SIG=129r5ac6n/M=298184.5285298.6392945.3001176/
D=groups/S=1705115364:HM/EXP=1094920857/A=2319498/R=0/SIG=11thfntfp/*htt
p://www.netflix.com/Default?mqso=60185352&partid=5285298>       
        
<http://us.adserver.yahoo.com/l?M=298184.5285298.6392945.3001176/D=group
s/S=:HM/A=2319498/rand=370914948>       

        ________________________________

        Yahoo! Groups Links
        

        *       To visit your group on the web, go to:
                http://groups.yahoo.com/group/-vb/
                  
        *       To unsubscribe from this group, send an email to:
                [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> 
                  
        *       Your use of Yahoo! Groups is subject to the Yahoo! Terms
of Service <http://docs.yahoo.com/info/terms/> . 

        
        




------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/k7folB/TM
--------------------------------------------------------------------~-> 


'// =======================================================
    Rules : http://ReliableAnswers.com/List/Rules.asp
    Home  : http://groups.yahoo.com/group/vbHelp/
    =======================================================
    Post  : [EMAIL PROTECTED]
    Join  : [EMAIL PROTECTED]
    Leave : [EMAIL PROTECTED]
'// =======================================================
 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/vbhelp/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to