473,406 Members | 2,390 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

CMDialog - File open - default view

Im using the CommonDialog activeX control to select multiple file names. However I would like to be able to control using code the resulting view of the files as you can do in realtime using the view menu, ie details, thumbnails, icons etc.

I've tried changing the default view in windowsXP for that folder but the resulting view always defaults to thumbnails.

I'd also like to be able to control the order of the filenames in the dialog as you can do in realtime by right clicking in the dialog and choosing "arrange icns by".

This is my current code:

CMDialog.FileName = ""nothing
CMDialog.DialogTitle = "Select photo/s..."
CMDialog.Filter = "jpg|*.jpg"
CMDialog.Flags = cdlOFNAllowMultiselect Or cdlOFNExplorer Or cdlOFNHideReadOnly
CMDialog.InitDir = "C:\Documents and Settings\Myuser\My Documents\My Pictures\somefolder"
CMDialog.MaxFileSize = 32000
CMDialog.ShowOpen 'opens fileopen
strInputFileName = CMDialog.FileName

I'd hoped that there was a CMDialog.Flag that could be set to control this?

Any advice most welcomed, thanks Mark
Jul 8 '06 #1
1 6565
PEB
1,418 Expert 1GB
See how the expression is used in the sub: msoFileDialogViewDetails

For more information type FileDialog and select FileDialog Object from the list

There is more info!

Have a nice day


The following example displays a File Picker dialog box in details view using the FileDialog object and displays each selected file in a message box.

Sub Main()

'Declare a variable as a FileDialog object.
Dim fd As FileDialog

'Create a FileDialog object as a File Picker dialog box.
Set fd = Application.FileDialog(msoFileDialogFilePicker)

'Declare a variable to contain the path
'of each selected item. Even though the path is a String,
'the variable must be a Variant because For Each...Next
'routines only work with Variants and Objects.
Dim vrtSelectedItem As Variant

'Use a With...End With block to reference the FileDialog object.
With fd

'Set the initial view to the details view.
.InitialView = msoFileDialogViewDetails

'Use the Show method to display the File Picker dialog box and return the user's action.
'If the user presses the action button...
If .Show = -1 Then

'Step through each string in the FileDialogSelectedItems collection.
For Each vrtSelectedItem In .SelectedItems

'vrtSelectedItem is a String that contains the path of each selected item.
'You can use any file I/O functions that you want to work with this path.
'This example simply displays the path in a message box.
MsgBox "Selected item's path: " & vrtSelectedItem

Next vrtSelectedItem
'If the user presses Cancel...
Else
End If
End With

'Set the object variable to Nothing.
Set fd = Nothing

End Sub
Sep 6 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Raed Sawalha | last post by:
I have the following table which i can not switcha to design view error message said Could not open in Design view. Quote values differently inside a '<% ...."value"... %>' block. and the...
15
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update...
3
by: tigrrgrr42 | last post by:
I am working(vb.net03and05) with word documents stored in a sql db and I am currently bringing them from a byte array into a temp file to pop into word and make word do its thing as a com object. ...
2
by: Bob | last post by:
I looked at the sample in the msdn january 2005 - Introducing a new datagrid, but the project downloaded failed to open. Any one can point me to a bit of code on how to go and select an image...
6
by: qysbc | last post by:
I have a web page and there is a link to open a TIFF file. The way I do it is to have the server code open a binary stream, set the content type to "image/tiff" and call Response.BinaryWrite. On...
5
by: Seok Bee | last post by:
Dear Experts, I currently trying to use the FileUpload control from asp.net 2.0 to upload files. The uploading of the file I would like to store it in the Access Database. Unfortunately, I've no...
7
by: mark2802 | last post by:
When using CMdialog control to open multiple filenames is there a way to force the order in whch the resulting filenames are returned? I require the filenames to be returned in the order they were...
1
by: iwdu15 | last post by:
hi, how can i get the icon associated with a certain file type? thanks -- -iwdu15
11
by: GaryDean | last post by:
We created a "File" website on XP and transferred it over to server2003. Now we want to change it to an HTTP site. Without creating a new project and importing everthing, it there a way to convert...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...
0
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...
0
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,...

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.