troubleshooting Question

easy CheckedListBox question using vb .net 2005

Avatar of jbaisden
jbaisden asked on
Visual Basic.NET
4 Comments1 Solution235 ViewsLast Modified:


Okay guys this is pretty easy, yet I simply am not sure what to search to find the answer. I have a checked list box. I want it to work kind of like a drop down list where you can have a text field that is displayed and a value field that is the actual value used.

In my checked list box, I am adding a list of files in a given directory. I created a sloppy class to test the above and I'm not getting the results expected.


        files = Directory.GetFiles(fldrdlgTargetFolder.SelectedPath)

        For Each strFile In files
            chk.fullfile = strFile
            chk.shortfile = strFile.Substring(strFile.LastIndexOf("\"))
            chklbTargetFiles.Items.Add(chk)
            chk = New chunk
        Next

All of this is in the Form1 class. So is the following definiton for the class chunk:

   Private Class chunk
        Public fullfile As String
        Public shortfile As String
    End Class

Like I said, this was just meant to be quick and dirty. I am trying to display the shortfile attribute of chunk in the checkedlistbox. When I get the items that are selected, I want to the attribute fullfile from the chunk object stored for the given item(s).

When the program runs the text displayed for each item added is: FileCopier.Form1 + chunk

Am I missing something small or just barking up the wrong tree with this?

Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 4 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 4 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros