Changing Picture Box Image
Changing Picture Box Image
Changing Picture Box Image
Changing Picture Box Image
Changing Picture Box Image
Changing Picture Box Image Changing Picture Box Image Changing Picture Box Image Changing Picture Box Image Changing Picture Box Image Changing Picture Box Image Changing Picture Box Image Changing Picture Box Image
Changing Picture Box Image Changing Picture Box Image
Changing Picture Box Image
Go Back  Xtreme Visual Basic Talk > > > Changing Picture Box Image


Reply
 
Thread Tools Display Modes
  #1  
Old 03-29-2012, 04:30 AM
evnflow evnflow is offline
Newcomer
 
Join Date: Mar 2012
Posts: 1
Default Changing Picture Box Image


anyone know how to do this, but wit a browse for folder aspect..like i open up my browse for folder window, select the folder i want and it displays the .png file in picturebox..i'm trying to figure it out..here is what i have so far..i have it setup where i'm opening up a folder and loading certain files in my checkedboxlist..but i also want a .png file that is in the subfolders(the only .png file in the entire directory) to be displayed in the picturebox..but the folder is going to be changed depending on which folder is selected..so it can't be a set directory or path..basically has to change like the checkedboxlist..thank you in advance..

Code:
Private Sub Videos_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Videos.Click
        Dim fbd As New FolderBrowserDialog
        With fbd
            .ShowNewFolderButton = True
        End With
        If fbd.ShowDialog = DialogResult.OK Then
            With CheckedListBox1
                .DataSource = New IO.DirectoryInfo(fbd.SelectedPath).GetFiles("*.avi", IO.SearchOption.AllDirectories)
            End With
        End If
    End Sub

Last edited by Flyguy; 03-29-2012 at 06:58 AM.
Reply With Quote
  #2  
Old 03-29-2012, 06:20 AM
DrPunk's Avatar
DrPunkChanging Picture Box Image DrPunk is offline
Senior Contributor

* Expert *
 
Join Date: Apr 2003
Location: Never where I want to be
Posts: 1,403
Default

You shouldn't hijack threads for a new question. You should start a new thread with your question.

But anyway, you seem to have some of the functionality you need. Like you've got in your code how to seach a selected path for a particular file type.

And what you're trying to do here is find a png file in the selected file path.

So, breaking it down into seperate objects (your IO.DirectoryInfo call is doing quite a lot which you can't see)...
Code:
If fbd.ShowDialog = DialogResult.OK Then
    ' Create our directory to search
    dim d as new IO.DirectoryInfo(fdb.SelectedPath)
    ' A variable to read the searched files into
    dim files() as IO.FileInfo

    ' Look for a png in the selected folder
     files = d.GetFiles("*.png")

    ' Load a picturebox with the first png, making sure to check that it found at least 1
    if files.Length > 0 then
        picturebox1.Image = Image.FromFile(files(0).Fullname)
    endif
End if
__________________
There are no computers in heaven!
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Changing Picture Box Image
Changing Picture Box Image
Changing Picture Box Image Changing Picture Box Image
Changing Picture Box Image
Changing Picture Box Image
Changing Picture Box Image Changing Picture Box Image Changing Picture Box Image Changing Picture Box Image Changing Picture Box Image Changing Picture Box Image Changing Picture Box Image
Changing Picture Box Image
Changing Picture Box Image
 
Changing Picture Box Image
Changing Picture Box Image
 
-->