473,804 Members | 2,111 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Listing Images in a List Box

Hello,

I would like to know if anyone as found a way to
list a image next to a list box to indicate what type of
drive (local or network) and a folder

I would like to present in a user interface like the OpenFileDialog
that has a pulldown(at the top of the dialog) to allow a user
to navigate a directory/folder selection.

I am just looking to extracted the Drive and folder only.
This code fragment will list drive letters and folders.

Dim dirInfo as Directory
Dim drive,dirpath as string

Me.ComboBox1.It ems.Clear()

dim drives() as string = dirInfo.GetLogi calDrives()
For Each drive in drives
Try
Dim paths() as string = Director.GetDri ectories(drive) 'Only grab
drives that are available
For Each dirpath in paths
Me.ComboBox1.It ems.Add(dirpath )
Next
Catch ' ignore errors/drives that are not ready ie A:\ or a CD or
DVD drive...

End Try

Me.ComboBox1.Se lectedIndex = 1 ' Now select the first Item found

I would like to list the images just like the OpenFileDialog to give the
user a graphical representation
of the directories and paths found.

Thank you


Nov 20 '05 #1
4 2011
Cor
Hi James,

You ask a listbox, the answer on that is easy use a listview, but then I saw
your code is about a combobox.

And if it is a combobox, then did you see it before somewhere, when not, you
mostly have to draw it yourself.

Cor
Nov 20 '05 #2
>I would like to know if anyone as found a way to
list a image next to a list box to indicate what type of
drive (local or network) and a folder


If you are using a combobox then set the draw property to
OwnerDrawVariab le and then implement the ItemDraw event of the control
(you'll need an image list with the images you want to use):

<code>
Private Sub MyCombo_DrawIte m(ByVal sender As Object, ByVal e As
System.Windows. Forms.DrawItemE ventArgs) Handles MyCombo.DrawIte m
'Places icon for the tag next to the tag text

Dim MyText as String = "My Item Text"

e.DrawBackgroun d()
MyImages.Draw(e .Graphics, e.Bounds.Locati on,
SelectedTag.Ima geIndex)
e.Graphics.Draw String(MyText, Font, New
SolidBrush(e.Fo reColor), e.Bounds.X + MyImages.ImageS ize.Width,
e.Bounds.Y)
e.DrawFocusRect angle()

End Sub
</code>

Hope this helps.

Tom
Nov 20 '05 #3
* "James Kunicki" <ji***@snet.net > scripsit:
I would like to know if anyone as found a way to
list a image next to a list box to indicate what type of
drive (local or network) and a folder


Why not use a ListView control instead?

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
It sounds like you just want the user to be able to select a folder. Why
don't you use the Folder Browser Dialog Control. I believe it was made
available with Visual Studio 2003.

"James Kunicki" <ji***@snet.net > wrote in message
news:ep******** ******@TK2MSFTN GP10.phx.gbl...
Hello,

I would like to know if anyone as found a way to
list a image next to a list box to indicate what type of
drive (local or network) and a folder

I would like to present in a user interface like the OpenFileDialog
that has a pulldown(at the top of the dialog) to allow a user
to navigate a directory/folder selection.

I am just looking to extracted the Drive and folder only.
This code fragment will list drive letters and folders.

Dim dirInfo as Directory
Dim drive,dirpath as string

Me.ComboBox1.It ems.Clear()

dim drives() as string = dirInfo.GetLogi calDrives()
For Each drive in drives
Try
Dim paths() as string = Director.GetDri ectories(drive) 'Only grab
drives that are available
For Each dirpath in paths
Me.ComboBox1.It ems.Add(dirpath )
Next
Catch ' ignore errors/drives that are not ready ie A:\ or a CD or
DVD drive...

End Try

Me.ComboBox1.Se lectedIndex = 1 ' Now select the first Item found

I would like to list the images just like the OpenFileDialog to give the
user a graphical representation
of the directories and paths found.

Thank you

Nov 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
2530
by: Kim Jensen | last post by:
I'd like to make a directory listing where instead of the entire filename I need it to show the filename minus the extention and get the value of charname= in the file itself. I've been told that I had to turn the directory listing into an array and then use "foreach (array as item)" to go through and open each file but I've tried several different approaches and I just can't get it to work. I've been able to make it list the directory...
1
3931
by: Gema Gema | last post by:
I have a large collection of directories full of various files and am looking to create custom text files for the contents of each directory. Here is the situation: The directories are named with a name and number, i.e. Smith1234567. I am looking to create a text file named with the number portion of the directory name (1234567.txt). The contents of the text file would look similar to the following, where the "TIF" files at the end of...
7
3299
by: PhilM | last post by:
New to javascript. Is it possible to use javascript to scan a directory client side. If so, could someone point me in the general direction of information on how to. I do not know what keywords I should be googling for :( I am aiming to return array of image files to use in a 'slideshow' script that will be cut to cd. I have already found a slideshow script, but now need to populate array, and will be using php to ultimately write the...
10
2470
by: Chris | last post by:
Hi, Not sure if this is the right forum, but hopefully someone can help me. I am creating something for our intranet and i want to list the files and folders of a directory, i found some code to do this. The only problem is that it lists the asp file used to for example if i go to: "http://myserver/listing.asp" In the file listing will be "listing.asp" amongst a lot of marketing documents.
19
3317
by: SU News Server | last post by:
I've struggled with this for quite a while and I'm am just not sure what is going on. I have the following code import os def buildList( directory='/Users/mkonrad' ) dirs = listing = os.listdir(directory)
8
11068
by: gil | last post by:
Is it possible to prevent a browser from listing the entire contents of a folder? The site, is hosted on my ISP with the following layout- site/ "user name from ISP" pagefile (dir) index.html site/pagefile/
2
1714
by: ngr | last post by:
I used to use the DirListox control in VB6 but this is no longer supported in VB.NET. What I want to do: I want to take a directory listing and show any subdirectories in a list. When you click on a directory in the list another list appears with the directory listing of files and directories within it. Can anyone please advise how to take a list of directories within a directory and then independantly of that another routine to take...
2
1585
by: Marco Pais | last post by:
Hi there. First of all, sorry for my poor english. I have a problem that I don't know how to resolve. I want to make a dynamic image gallery. With an ASP script, I will read the images from a folder and display them on a table, for example. The script is something like this: <%@ Language=VBScript %> <HTML>
0
898
by: Steve Hellier | last post by:
Hi, I have 1 solution with 2 projects (ClassLibraray1 - which currently have 6 images embedded in a resource file and WinFormApp1 - which has a picturebox and a listbox) I'm trying to display the list of image names in the listbox. I have searched the web and can only find examples of displaying images if you know the resource name. In my WinFormApp1 I have
0
10595
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10343
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10341
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10089
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9171
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7634
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5530
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5673
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3001
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.