URGENT: Display selected image files onto 6 PictureBoxes and .....

Posted on 2003-03-30
Medium Priority
Last Modified: 2010-05-18

i hav 2 FileListBoxes with four command buttons. I hav done the part on selecting the file combo type, drive path, file directory & text box to display the files. BUT, i do not know how to do the following
below problems in VB6. Pls help me. Its urgent.

Button 1 -> Select one highlighted file in FileListBox1 & make them appear in FileListBox2.
Button 2 -> Select all files in FileListBox1 & make them appear in FileListBox2.
Button 3 & 4 is the reverse. De-selecting files frm FileListBox2 back to FileListBox1.

Once the file selected appear over at FileListBox2, the one at FileListBox1 will disappear & vice versa. Btw, Listbox or FileListBox better for this case?

After u hav selected the files(images files) which are now in FileListBox2, there is a "OK" command button that will load the 1st 6 image files onto 6 PictureBoxes in another FORM. How to load the 1st 6 image files onto 6 PictureBoxes with a "NEXT 6" & "BACK" buttons to traverse 6 pictures at a time down the list of image files selected.

How to invoke the Printer Properties window where u can configure the settings of the printer tat is attached to yur PC & send the 6 pictures on display to print? Pls help me out. Any sample code are most welcome. Thanxs alot.

Question by:Megadeth
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 8237217
Filelistboxes interact with OS, so if you want a file disappear from filelistbox you should erase the file from file system. It is better use list boxes and a visible=false filelistbox, fill your first listbox from lists of filelistbox. And play with listboxes.
There is an object printer use its properties to set and select printer object. I am adding an MSDN document part to select printer, hope helps.

Using the Printers Collection

The Printers collection is an object that contains all the printers that are available on the operating system. The list of Printers are the same as those available in the Print Setup dialog box or the Windows Control Panel. Each printer in the collection has a unique index for identification. Starting with 0, each printer in the collection can be referenced by its number.

Regardless of which printing method you use, all printed output from a Visual Basic application is directed to the Printer object, which initially represents the default printer specified in the Windows Control Panel. However, you can set the default printer to any one member in the Printers collection.

To select the printer from the collection, use the following syntax:

Set Printer = Printers(n)

The following statements print the device names of all the printers on the operating system to the Immediate window:

Private Sub Command1_Click()
Dim x As Printer
   For Each x In Printers
      Debug.Print x.DeviceName
End Sub

Note   You cannot create new instances of the Printer object in code, and you cannot directly add or remove printers from the Printers collection. To add or remove printers on your system, use the Windows Control Panel.


Accepted Solution

otherviceroy earned 450 total points
ID: 8242353
On the subject of displaying pictures...

Suppose your pictureboxes are on Form2 and strPathOfPicture is the file path (eg. C:\Pictures\picture.bmp)

Private Sub Command1_Click()
'Load and show the picture form
'Load the picture into the box
Form2.Picture1 = LoadPicture(strPathOfPicture)
'now do the same for the remaining five boxes
End Sub

what you can do is have a 6-item string array, each item being a picture path. then, at the end of the command1_click() sub you can reassign the values to the next six from the filelistbox

hope this helps...

Author Comment

ID: 8242659
To: otherviceroy

thanxs for yur help.i need to ask u something. hope u dun mind. i created 6 PictureBox on form2 as array like Picture(0), Picture(1) etc. So tat is not neccessary if we are going to hav a string array for the PathofPicture, rite?

pardon me, becos im new to Visual Basic. Im only very average in C++ programming. Therefore, alot of things in VB, i need some help. im not really sure abt how u assign all the files selected in the fileListBox2 as string arrays & then assign the next six down the list. Do i hav to use a For Loop to assign the next 6?

Btw, wats the best way to solve my 1st problem regarding selecting the files tat appear in fileListBox1 after i had browse to the folder that i wanted (i hav done the drive path, directory path & file type) and then selecting the files simply by clicking on it using mouse & then with a command_button1, the file will then appear on fileListBox2. The two fileListBox are beside each other on form1. Tats why, the files selected & now appearing in filelistBox2 will then be displayed in sets of 6 in those PictureBox on form2.
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Author Comment

ID: 8242788
To iozturk:

thanxs for the code for invoking the Printer Properties. As for the file selection & de-selection between the 2 fileListbox. u recommended ListBox, issit becos its easier to use AddItem to add the files selected from the 1st filebox?

Btw, the 2 listbox are side by side. The left listbox has all the files of the current folder i hav browse using combobox, drivelistbox & dirlistbox and then when i click the file & then assign a command_button to make the file appear on the right listbox, i jus want the right listbox to hav tat file name & its path of file, so tat i can proceed to display them on the 2nd form. The selected file tat appears on the right side, will disappear on the left side. No files are deleted physically. How to solve it? Thanxs.


Author Comment

ID: 8242812
To: otherviceroy

i should use ListIndex for either listbox or filelistbox if i wanna hav a string array for the strPathofPicture, rite?

Expert Comment

ID: 8531282
Hi Megadeth,
This old question (QID 20568473) needs to be finalized -- accept an answer, split points, or get a refund.  Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.

Author Comment

ID: 8537769
thanxs for yur help. As u only answer part of the question, i gave 3/4 of the total points. Hope tats alrite wif u cos im in need of points to ask questions as im on a very tight schedule to complete a VB assignment.sorry, hope u understand. thanxs once again for yur help.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question