Working with images in all different ways

Level:
Level2

Written By TheVBProgramer.

The Image Control

 

You've already seen in the previous topic that with an Image control, you can set it's Picture property at design time by going to Picture property, clicking the ellipsis (…), and selecting a file from the Load Picture dialog box. Recall that the main types of files that can be assigned to an Image control are .bmp, .jpg, .ico, and .wmf.

 

The Image control has a Stretch property, which is set to False by default. When the Stretch property is False, the Image control will automatically resize itself to expand or contract to the size of the picture that is assigned to it. If instead you want the image to fill the specific size that you make the Image control, set the the Stretch property to True, which will cause the picture you assign to the Image control to automatically expand or contract to conform to the size of the control. Depending on the type of image, the image may or may not appear distorted when stretched – this is something you need to experiment with.

 

You can also set the Picture property of an image control in code by using the LoadPicture function, which loads a picture from a file into the control at run-time. The LoadPicture function takes a file name as an argument. Sample syntax is:

 

imgMyPic.Picture = LoadPicture("C:\SomeDirectory\SomeSubDir\MyPic.bmp")

 

"Picture" is the default property of the image control, so the above statement could have been written as:

 

imgMyPic = LoadPicture("C:\SomeDirectory\SomeSubDir\MyPic.bmp")

 

(Note: In my earlier VB programming, I would typically omit the default property of controls; however, I now advocate explicitly coding all properties – so I recommend keeping the ".Picture" on there.)

 

Keep in mind the following general points about setting the Picture property of a control using LoadPicture at run-time compared to selecting a file for the control's Picture property at design-time:

  • When you set the picture at design-time, that picture becomes embedded in your application (it is stored in the .frx file of the form that is using it). Therefore, your program is bigger, but runs faster because the picture is in memory when your program loads.
  • When you use LoadPicture, the program is smaller because the image is not embedded in the application, but resides in a separate file. However, the image processing is slower because the program must access it from disk.

 

To clear the picture from an image control, use the LoadPicture function with an empty set of parentheses:

 

imgMyPic.Picture = LoadPicture()

 

If you have more than one image control on a form, you can copy a picture from one image to another via an assignment statement like this:

 

imgPic1.Picture = imgPic2.Picture

- or -

imgPic1 = imgPic2

 

A common technique to change an image on a form at various points in the program is to use a number of image controls as a "repository". The images in the "repository" will all have their Visible property set to False. At the desired time, the program will assign one of the images from the "repository" to the image to be displayed. The following sample program demonstrates this technique.

 

The sample program displays a traffic light that alternates color from green to yellow to red every half of a second. All images used are icons from the folder:

Program Files\Microsoft Visual Studio\Common\Graphics\Icons\Traffic.

 

To build the sample program, use the figure below as a guide to place the indicated controls on the default form and set the properties of the controls to the values indicated in the callouts.

 

 

The code for the program is as follows:

 

Option Explicit

 

Private mstrCurrColor As String

 

Private Sub Form_Load()

mstrCurrColor = "G"

imgLight.Picture = imgGreenLight.Picture

End Sub

 

Private Sub tmrChangeLight_Timer()

 

If mstrCurrColor = "G" Then

imgLight.Picture = imgYellowLight.Picture

mstrCurrColor = "Y"

ElseIf mstrCurrColor = "Y" Then

imgLight.Picture = imgRedLight.Picture

mstrCurrColor = "R"

Else

imgLight.Picture = imgGreenLight.Picture

mstrCurrColor = "G"

End If

 

End Sub

 

When the program runs, the traffic light will alternate in color between green, yellow, and red at intervals of one half of a second:

 

 

 

Download the VB project code for the example above here.

 

 

The PictureBox Control

 

Like the Image control, the PictureBox control can be used to display images. However, the PictureBox can do much more. Like the Frame control, the PictureBox is a "container" control, meaning that other controls can be placed inside it. In addition, the PictureBox can be used to generate run-time graphics and to display text. As a general rule of thumb, if your application requires the special capabilities of the "heavyweight" PictureBox, then use it; but if all you want to do is display an image, then use the "lightweight" Image control.

 

Using Images with the Form

 

The Form has both a Picture property and an Icon property. The Form's Picture property is used to display an image directly on the form; this can be suitable for displaying a background image. In the screen shot below, the Form's Picture property was set to a file called "Santa Fe Stucco.bmp". The image is displayed starting in the upper left-hand corner of the form and cannot be moved or resized. If you want to display an image directly on the form like this, and you want the image to fill the entire background of the form, you must make sure the image to be used is the same size or larger than the size you want to make the form. (If the image you want for the background of the form is too small, use an Image control that you set to be the same size as the form with its Stretch property set to True, as was done in the previous topic's sample program with the "clouds.bmp" image.)

 

 

Note: To clear the Picture property at design-time, highlight the entry for the Picture property ("(Bitmap)" in this case), and press the Delete key.

 

 

The Form's Icon property is used to set the icon that is displayed in the left-hand corner of the Form's title bar. In the screen shot below, the Form's Icon property was set to the SUN.ICO icon from the Program Files\Microsoft Visual Studio\Common\Graphics\Icons\Elements folder.

 

 

When you compile a VB program, the icon used for the resulting EXE is determined by the setting of the Icon property of the Form you specify on the "Make" tab of the project's properties sheet (accessed from the IDE's Project menu item). As shown below, the icon that will be used for this application's EXE will be the "sun" icon from "Form1". If the project had more than one form, then you could choose which form's icon would be used for the EXE by selecting the appropriate form name from the "Icon:" drop-down box:

 

 

 

 

The Picture Property of the Command Button

 

The Command Button control has a Style property, which, when set to 1–Graphical, enables you to display a picture on the button via the command button's Picture property. (Also – when the Style is set to 1-Graphical, you can change the BackColor of the button, which you cannot do when the Style is set to 0-Standard.)

 

If the command button also has a non-blank value for its Caption property, the text of the caption will appear below the picture. (Note: In VB6, you cannot specify the position (left, right, below) of the picture relative to the caption on the command button: the picture will always appear above the caption. A custom button control would be needed to display the picture to the left or right of the caption on the button.)

 

The screen shot below shows two command buttons with images (the images shown are from a custom icon set):

 

 

The command button also has a DisabledPicture property, which allows you to specify an alternative image to be displayed on the button when the Enabled property is set to False:

 

 

If you don't use the DisabledPicture property, the system will "do its best" to render a disabled image based on the original – what it comes up with may or may not be acceptable to you:

 

 

Another technique used with "picture buttons" is to place only a picture on the button and leave the Caption blank – then use an adjacent Label control to describe the function of the button, as shown in the "switchboard" type screen below:

 

 

 

Using Images with Other Controls

 

Images can be used with many with other controls. In later topics, a set of controls called the Windows Common Controls will be explored. This set of controls comprises the ToolBar, TreeView, ListView, TabStrip, StatusBar, and several others. These controls are used in conjunction with an ImageList control, which serves as a repository for images to be used for items within the controls (i.e. icons for the Toolbar buttons, TreeView nodes, ListView list items, etc.) The screen shot below shows a portion of a screen used by an application that uses a ToolBar, TreeView, and ListView.

 

 

Finding Images to Use with Your Applications

 

Probably the most challenging aspect of incorporating images (particularly icons) into your application is not the actual programming, but simply the search for the "right" icon or image to represent the function or concept to be worked with in your application's user interface.

 

As mentioned previously, Visual Studio 6/Visual Basic 6 comes with a set of over 900 graphic files (over 500 of which are icons). When Visual Studio 6 or VB 6 is installed, the Graphics folder is NOT installed by default (whoever is installing it must explicitly check the "Graphics" option during the appropriate step of the installation). Assuming that the Graphics are installed, by default they will be placed in the directory structure shown below:

 

 

The Icons folder contains 13 subfolders. As a reference, and for convenience, screen shots of the contents of the icon folders are shown below:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Even with all of the icons and other graphic files included with VB, you may not find images that you deem suitable for your application. Not all "categories" of icons that you might expect are present in the included collections, and those that are included would be regarded by some as "dated" (the offering of included icons has not changed since VB 3.0 back in 1995). Fortunately, there are numerous resources on the Internet for icon collections (ranging in price from free to several hundred dollars) as well as resources for working with icons (creating your own and/or modifying existing icons).

If you enjoyed this post, subscribe for updates (it's free)

vb 6.0

can any buddy help me?
my problem is that .....i want to load an image in image control .....i used
image1.image=loadpicture("d:\MyPic.jpg")....yeah it has worked well..
but instead of this i want to use variable in the place of file name..............can any one help me plzzz?

help me

l needs code for extraction image fingerprint pore please

Dim sec As Integer Dim min As

Dim sec As Integer
Dim min As Integer
Dim hou As Integer
Dim t1 As String
Dim t2 As String
Dim t3 As String

timer code
sec = sec + 1
ProgressBar1.Value = sec
If ProgressBar1.Value = 59 Then
ProgressBar1.Value = 1
End If
If sec = 59 Then
t1 = "0"
sec = 0
min = min + 1
End If
If min = 59 Then
t2 = "0"
min = 0
hou = hou + 1
End If
If sec >= 10 Then
t1 = ""
End If
If min >= 10 Then
t2 = ""
End If
If hou >= 10 Then
t3 = ""
End If
Time.Text = t3 & hou & ":" & t2 & min & ":" & t1 & sec
form load event

sec = 0
min = 0
hou = 0
t1 = "0"
t2 = "0"
t3 = "0"

it is not working please help me...!!!

Reply to comment (VB6)

When I initially commented I clicked the "Notify me when new comments are added" checkbox and now each time a comment is added I get four emails with the same comment.
Is there any way you can remove people from that service?
Many thanks!

problem relating option button

i want set image for option button without changing its style property to graphical..plz someone help me....

FirstComeFirstServed

can you send me the design and program of the FirstComeFirstServed?using vb=2008

FirstComeFirstServed

can you send me the design and program of the FirstComeFirstServed?

How to store images in

How to store images in database using raw or blob????
please dont use load picture () .It will not work if i run my application on different PC.

Problem Using Icons!!!

hi I have Downloaded many icons from the internet. The format of icons is correct, (16x16,32x32,64x64; .ICO, .PNG) But when i used it in VB6, it says, "Invalid Picture"! Please tell Me Any solution or Suggest any site where i can find icons which compatible with VB6.

working with toolbars

I'm working with objects and ListImage toolbar but I sent the error 5, as if he had filled a limit of objects, where do I can extend this limit?

add my code with the problem

Set imgX = ImageList1.ListImages.Add(, "search", LoadPicture(App.Path & "\zoom.gif", vbLPSmallShell, , 10, 10))
Set imgX = ImageList1.ListImages.Add(, "nsearch", LoadPicture(App.Path & "\document.gif", vbLPSmallShell, , 10, 10))
Set imgX = ImageList1.ListImages.Add(, "markCaf", LoadPicture(App.Path & "\document_edit.gif", vbLPSmallShell, , 10, 10))
Set imgX = ImageList1.ListImages.Add(, "undoCaf", LoadPicture(App.Path & "\interact.gif", vbLPSmallShell, , 10, 10))
Set imgX = ImageList1.ListImages.Add(, "addAcc", LoadPicture(App.Path & "\user_add.gif", vbLPSmallShell, , 10, 10))
Set imgX = ImageList1.ListImages.Add(, "adjust", LoadPicture(App.Path & "\other.gif", vbLPSmallShell, , 10, 10))
Set imgX = ImageList1.ListImages.Add(, "other", LoadPicture(App.Path & "\mark.gif", vbLPSmallShell, , 10, 10))
Set imgX = ImageList1.ListImages.Add(, "locks", LoadPicture(App.Path & "\lock.gif", vbLPSmallShell, , 10, 10))
Set imgX = ImageList1.ListImages.Add(, "Send", LoadPicture(App.Path & "\excel2_app.ico", vbLPSmallShell, , 10, 10))
Set imgX = ImageList1.ListImages.Add(, "chgName", LoadPicture(App.Path & "\user_black.gif", vbLPSmallShell, , 10, 10))
Set imgX = ImageList1.ListImages.Add(, "close", LoadPicture(App.Path & "\close.gif", vbLPSmallShell, , 10, 10))
-->Set imgX = ImageList1.ListImages.Add(, "Empty", LoadPicture(App.Path & "\folder_open.gif", vbLPSmallShell, 10, 10))
Set imgX = ImageList1.ListImages.Add(, "Download", LoadPicture(App.Path & "\down.gif", vbLPSmallShell, 10, 10))

image list control

is possible that you can upload image or pictures by using a command button rather than going to imagelist properties and then insert pictures?
i mean instead of using insert pictures to properties is there possible that my command button do it for me?? please send me some codes thanks:D

I have problem on how to load a picture on registration Form

Please help I have problem araising from my database. I have made database about my institution in the registration form I want to add all required information grathering from the students I hit the problem of picture while I am using visual basic 6.0 on the form of registry I want to add student's photos when is registering I have no Idea about it nor code and how to store in SQL the type of sring i choosing.
please if you know that help

I have problem on how to load a picture on registration Form

Please help me I have problem araising from my database. I have made database about my institution in the registration form I want to add all required information grathering from the students I hit the problem of picture while I am using visual basic 6.0 on the form of registry I want to add student's photos when is registering I have no Idea about it nor code and how to store in SQL the type of sring i choosing.
please if you know that help

limit the file size of photos to be uploaded

how the writing is right when we want to make the image upload facility in VB6 using the common dialog and limit the file size of photos to be uploaded?

please help me!

database

am using stringless connection but i can't move next, or previous rather it is moving first and last. and i don't know how i can load picture into datareport so that when i move next the picture will change to the next person's picture. thanks in anticipation

VB 6 IMAGE CONTROL

how to get picture from common dialog control to chose any picture and load into the access database

camera

please help..... how to apply my laptop camera in the form to capture and saving a pictures...thanks

camera

hi can you help me plz how to put my camera on the form, what VB tool i use an
d what is the code...plzz.......

VB image loading

please...help!!! I need a VB code for loading images, interpret and detect image from the scanner...
Please...help!!I need this badly...

how to insert image in visual basic

how to insert image in VB .after make the form the image is invisiable .after click that is visiable.plz send me coding of that program

I can't conceive how to do

I can't conceive how to do this and get animated images. Could give give brief comments and a couple of lines of code to get me started.

help with saving command using data enviroment

hi all,
i have a project to do and am using dataenviroment but i cant save the files to my database
please help

Project Guide

Sir/Mam
Iwant to know how to start Vb project what Procedure?
Mugees Ahmad

Loading an image in VB using Vc++.

Please help????? Urgent!!!!

HOW CAN I ADD THE ANIMATED FILE INTO IMAGE BOX

Hello... anyone can tell me how to add the animated graphics files into my vb form and how can i run it...

Animation

if you want to add animation, use .gif files in loading pictures.. or just use Flash animations..

Animation wrong info

animated .gif doesnt work with Default Picture components. You need to flip it with looping

Animation

re animaion looping of picturebox. I can't conceive how to do this and get animated images. Could give give brief comments and a couple of lines of code to get me started.

Thanks, John Smyth

Image

Dear Sir

I Want to know "how to insert image at run time?"

Elango.K
+91-9842604398

image control

sir,
i want to keep some image paths in an excel sheet column. can i use
variablename=selection.value
Image1.Picture = LoadPicture(variable name insted of path)

Load Image at Run Time

Hi, Can anyone help me how to create a program to ask for the user to load image at run time and display it?

e.g. Uploading pictures in social networking profiles.

Show image at runtime


''''add a cmd button
''''add a picture box
''''add a image contorol and set its property : strectch to true:
Private Sub command1_click()
Dim imgpath As String
imgpath = InputBox("Please enter image path", "image oath", "C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Sunset.jpg")
Picture1.Picture = LoadPicture(imgpath)
Image1.Picture = LoadPicture(imgpath)
'''note the difference image1 fits well where as picture box '
''' does not , this coz of the property strectch
End Sub

Load Image at run time.

First and foremost,
this codes snippet really isn't mine.
but here it is.

Private Sub Pic1_Click()
Dim l As String

On Error GoTo ErrorHandler
With objCD
.CancelError = True
.DialogTitle = "Open Image"
.Filter = "Images|*.gif;*.jpg;*.jpeg;*.png;*.bmp;*.raw;*.rle|All Files|*.*"
.ShowOpen

' Loading picture on the first picture box
Pic1.Picture = LoadPicture(.FileName)

' Writing image properties
lblPath.Caption = "Reference Image: " & .FileName
lblSize.Caption = "Image Size: " & Pic1.ScaleWidth & " x " & Pic1.ScaleHeight
lblPic1.Caption = "File Name: " & .FileName

End With

ErrorHandler:
End Sub

please take note that
pic1 is a picture box

hope i've help
P.S
You need to check the Microsoft Common Dialog Control 6(SP3) on the components(CTRL+T).
then draw the common dialog box on your form.
in here, I named it obj.

Thanks all Works fine for me.

Thanks all
Works fine for me. Now I can load my pictures.

Sizing a webcam picture for thumbnail

Hi. We have web cam pics as .jpg's, but when I load the pic in VB6, I want the pic sized to fit a thumbnail size, but all I can actually see is the top corner of the actual pic.
Then I tried using an image, which shows the whole pic, but the control has now been resized at run time to be the size of the pic which is way too big. I want a standard thumbnail size!

Any suggestions?

vb6 image from access

hi there.. i just want to create a program in vb6 that is using ms access as its database, i use adodc to connect them.. i already bind those with the textboxes but the problem is i dont know how to bind the images in order to view them on vb6 along with their corresponding names and information. can you please help..
heres my email..
ians_acess@yahoo.com

re: vb6 image from access

I was able to accomplish this by using a dataSet. With the DataSet, I changed the Image column type to 'image' before dragging the dataset onto the form.

Now, just to figure out how to upload images from the application to the database. I hope this helps you some though---if not too little too late :)

Depending on the type of

Depending on the type of image, the image may or may not appear distorted when stretched – this is something you need to experiment with.

how can i bind picture to vb6 using ms access

hi im just a 1st yr collegestudent, i just want to ask ahm i used adodc connection in vb and access, im trying to build a program in vb. data are from access but adodc cconnection only show text,can i also bind a picture on it along with their corresponding details from access,,, pls help

use this code to bind images

use this code to bind images with picture boxes Mr.p
1.Make 4 picture boxes with corresponding images of your info.
2.Make another pic box named "PictureShow"
3.make a timer >set interval to your choice
4.make a textbox which reads the primary key no.
follow the code
Private Sub Timer1_Timer()
If Text1.Text = "1" Then
PictureShow.picture = Picture1.picture
ElseIf Text1.Text = "2" Then
PictureShow.picture = Picture2.picture
ElseIf Text1.Text = "3" Then
PictureShow.picture = Picture3.picture
ElseIf Text1.Text = "4" Then
PictureShow.picture = Picture4.picture
End If
End sub

Now when you change the item selection then
the corresponding picture will appear

'If the code doesn't work then call "Help MR.P"
then i'll come up with aonther code

vb

hi, However how can you give me the code on how I am going to save the picture in the database or in the ms access?.

Answer : how to bind images with pictureboxes Mr.p

use this code to bind images with picture boxes Mr.p
1.Make 4 picture boxes with corresponding images of your info.
2.Make another pic box named "PictureShow"
3.make a timer >set interval to your choice
4.make a textbox which reads the primary key no.
follow the code
Private Sub Timer1_Timer()
If Text1.Text = "1" Then
PictureShow.picture = Picture1.picture
ElseIf Text1.Text = "2" Then
PictureShow.picture = Picture2.picture
ElseIf Text1.Text = "3" Then
PictureShow.picture = Picture3.picture
ElseIf Text1.Text = "4" Then
PictureShow.picture = Picture4.picture
End If
End sub

Now when you change the item selection then
the corresponding picture will appear

Or

you can create a column in MS acess with the locations of your picture corresponding to the information
and in your form do this:-
1.create a text box text1 which reads your picture location
Private Sub Timer1_Timer()
If Text1.Text = "" Then
else
pictureshow.picture = text1.text
End If
End Sub

'If the code doesn't work then call "Help MR.P"
then i'll come up with aonther code

Answer : how to bind images with pictureboxes

Use this code to bind images with picture boxes
Method 1-
----------------------------------------------------------------------
For four items
1. make 4 pictureboxes which contain your images.
2.make a id number in ms access file make a text box which reads from the
now follow the code
Private Sub Timer1_Timer()

End Sub

image box

i didnt get it....so confused...

about image and tables with calculation problem

Dear Sir
Sir i have some problem. i m creating a project in visual basic. but i have some problem in this as given below:-
1. i want to that how we can insert a picture on a form in a passport size. and i want when we open the any record of person then his photo also show. please give me a source code for this.
2. i want to when we open a person record his details also show like, total amount due of his etc. and also a print

help about ICO files

what type of files can i use in command buttons? i downloaded a winrar file with ico pictures and when i loaded it in properties of command button it returns an error msg: invalid picture. what picture is VALID for command buttons? is there a pixel limit?

VB6 Doesn't Support...

You can't load a 32-bit truecolor/alpha transparency .ico file.
Using IcoFX (google it, it's free), load your icon and save it as a 24-bit true-color icon, as that's the most that Vb6 can support.
As for icon size, I'm pretty sure it can support 256x256 no problem, but I'm just guessing since I've taken it up to 48x48 without any errors.

VB6 doesn't supports icon

VB6 doesn't supports icon files with modern characteristics i.e. 256x256 or true color+alpha etc. In this case you can use a free Icon tool like the IconFX (http://icofx.ro) to actually "strip down" the unsupported Images from the ICO file. I really don't remember which properties are supported actually, but I believe it must be something like 8 bit color with a maximum of 16x16 pixels. But i 'm not sure start to strip down save and try. Trial and Error my friend...

VisualBasic

u can use .ico files for command buttons. Extract the downloaded winrar of .ico files and store to a particular location and then open it or specify the path correctly. u will be able to insert the .ico image perfectly.

loading picture from file in Visual Basic

Can someone gives me an explanation and sample code if possible:?

I make an inquiry program in database with over 100 employees and id like to put a picture in the program
with the corresponding person i've searched ?

Thanks a lot BRO!!

image from web browser

can you help me?

i need to get an image from web browser that i putted to my vb form.
the image to be loaded is to be place on the imagebox in my vb form.

thank you in advance.

Adding a New Image via VB

hey Guys, I have a little problem here.
i have to create a software where an image of a design needs to be added along with the Design ID as its name in a folder which can be used later to preview the design.
I know how to preview the design. But I don't know how to add them using Common Dialog Control

How Can I? Please.....

I am working on my thesis and i am just a beginner using vb. I need codes for my program that will upload picture together with other text data of the picture. I also need to edit what I uploaded after wards. I don't know how to control the database. thanks. I hope somebody can help me with this.

begginer needs help

hello

i am currently learning to use visual basic at my school during my computers class and am still a begginer.

as a little home project, i want to create a countdown timer that counts down from 20 seconds when open, using images (eg. image of number 20, number 19 etc.) and when this timer reaches 1 (1.bmp) i want it to run a file (i can make the program run a file, just not when it reaches 1), though i am unsure of what sytax to use to do this.

i was thinking:

if picbox1.image = ("1.bmp") then

OR

if picbox1.image Is ("1.bmp") then

or something along thoes lines, this may be fairly jumbled and hard to understand but please help.

Reply for Image List

One solution would be to firstly rename your files as 1, 2, 3, 4, ....20, save all of them in a particular folder and then use the following timer code:
firstly create a variable as int A and set its value to 20. This will be used to refer to your image

Private Sub T1_Timer()
t1.Interval = 50
picbox1.Image = & "\" & A & "<.jpg> or <.bmp>"
t1.Enabled = True
If A =1 Then

Else
A = A-1
End If
End Sub

try and do let us know

Remote accessing

Hi all,
I have a requirement where I have to access the image files at the server from a remote machine located and connected thru internet. I am able to do the same in loval machine. But, how to access the files in remote server or machine. can any one please send me the code snippet of the same to shankarravi18@rediffmail.com. its damn urgent......Thanx
Ravishankar

capturing picture

help me..... please!!!!!!
i wish to know to make a program that will capture the image of the user everytime they log in and save it automatically in t5he database(ms access)....

i hope you answer my question. i need it on my project..
Thanks in advance!!

gr8

Solved my prob...... simple and helpful article.........

I got it

The 2 comments below this comment is posted by me.
I GOT the ans to my Problem.

Help Please

This is my code
------------------------------------------
Option Explicit
Public Function LoadPicture(MyPic As Image)
imgMyPic.Picture = LaodPicture("f:\MyPic.jpg ")
End Function

Private Sub Form_Load()
LoadPicture
End Sub

-------------------------------------------

I am still getting error please help I am stuck

check spelling, loadPicture

check spelling, loadPicture

Try this Option

Try this

Option Explicit
Public Function LoadPicture(MyPic As Image)
imgMyPic.Picture = LaodPicture(MyPic)
End Function

Private Sub Form_Load()
LoadPicture("f:\MyPic.jpg ")
End Sub

You spelt load wrong

Im not sure whether you just copied it wrong here but you spelt load wrong (laod insted of load) try changing that then it should work

Help with Image problem

You can try this:

Private Sub Form_Load()
imbMyPic.Picture = LoadPicture("F:\MyPic.jpg")
End Sub

I hope this will work :)

Problem

The first program in this tutorial did not work.
I get an error variable not defined .
Please help

Image problem I need help with!

This could be long, so bare with me.
I want to be able to load a picture into a database. I can already do this by knowing the exact name of the file, but I would rather have a way of browsing the computers files, like in lots of programs for uploading images, and the just click the file that I want and save it.
Is this possible in VB6?

VB to save pictures from computer

1. Place the Common Dialoug Control (name- CommonDialog1) on your form
2. then add and Image control(name- Image1)
3. create a command button (name- Open)

write the following code

CommonDialog1.ShowOpen
Image1.Picture = LoadPicture(CommonDialog1.FileName)
lblRegistrationCard = CommonDialog1.FileName

From this common dialoug control you can access any picture from your computer

rock

using LoadPicture at run-time compared to selecting a file for the control's Picture property at d

Load Picture

Thanks a lot.. I 've been looking this kind of code for very long time.. However how can you give me the code on how I am going to save this in my database.

image control

I am having lots of scanned objects in .jpg format and the scanned objects are bigger than the monitor screen size and hence i am facing problem in displaying the scanned object within the image box control. If someone could tell me how to enable the user to navigate the whole scanned object using the scroll bars of the image control.

Stretch property missing...

I've updated my Visual Basic 6 with SP6 and there is no longer stretch property of the PictureBox. Can someone tell me how to make an image stretch using the new features? Or is there some bug or a problem? 10x in advance

Re: Stretch property missing...

The PictureBox control does NOT have a Stretch property! Only the Image control has a Stretch property.

This has got nothing to do with your using SP6. There's no kind of bug in your Visual Studio/Basic 6.0.

The PictureBox control does have an AutoSize property, but it doesn't really do the same thing as Stretch. You can give AutoSize a try, but I suggest you use the Image control instead.

   :-)
- SDR

Math

Wow! its realy for beginners..it could help a lot for a neophite like me

><

I didnt have the graphics folder so i couldn't do these >>

Me too !

Me too !

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>. The supported tag styles are: <foo>, [foo].

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.