Hi
I am trying to display an image in a dialog using the following code;
Dim frm As New frmImage
Dim z As System.Drawing. Bitmap
z.FromFile("c:\ temp\image.gif" )
frm.picImage.Im age = z
frm.ShowDialog( )
frm.Dispose()
Trouble is that no image appears in the dialog. What am I doing wrong?
Thanks
Regards 18 1863
PS: picImage is a PictureBox.
"John" <jo**@nospam.in fovis.co.uk> wrote in message
news:Ox******** ******@TK2MSFTN GP09.phx.gbl... Hi
I am trying to display an image in a dialog using the following code;
Dim frm As New frmImage Dim z As System.Drawing. Bitmap
z.FromFile("c:\ temp\image.gif" ) frm.picImage.Im age = z frm.ShowDialog( ) frm.Dispose()
Trouble is that no image appears in the dialog. What am I doing wrong?
Thanks
Regards
"John" <jo**@nospam.in fovis.co.uk> wrote in news:OxEaex3kDH A.1284
@TK2MSFTNGP09.p hx.gbl: I am trying to display an image in a dialog using the following code;
Dim frm As New frmImage Dim z As System.Drawing. Bitmap
z.FromFile("c:\ temp\image.gif" ) frm.picImage.Im age = z frm.ShowDialog( ) frm.Dispose()
Trouble is that no image appears in the dialog. What am I doing wrong?
I presume from the fact that you aren't indicating that the compiler is
failing that you really mean
z = Image.FromFile( "c:\temp\image. gif");
but there is another error. I think you are having a problem with your
backslashes in the filename... In general, you should always check a
variable before you use it. I would put money of the supposition that 'z'
is null after the call to FromFile(). To FIX the problem replace the line
with either:
z = Image.FromFile( @"c:\temp\image .gif");
(the @ tells the compiler not to interpret the '\' characters), OR
z = Image.FromFile( "c:\\temp\\imag e.gif");
-mbray
Evening John,
Put a breakpoint on the Image = z line and check the value of z. You'll
find that it's Nothing.
z.FromFile() is calling a <shared> method. It's the same as calling
Bitmap.FromFile (..). In other words it doesn't (can't) change z.
What you need is either:
Dim z As System.Drawing. Bitmap
z = Bitmap.FromFile ("c:\temp\image .gif")
or simply
Dim z As New System.Drawing. Bitmap ("c:\temp\image .gif")
Regards,
Fergus
Howdy Michael,
It's in VB so the syntax is fine, but it's true that the result should be
assigned to z.
Regards,
Fergus
"Fergus Cooney" <fi******@tesco .net> wrote in
news:u7******** ******@TK2MSFTN GP09.phx.gbl: It's in VB so the syntax is fine, but it's true that the result should be assigned to z.
Yeah I realized that and knocked on my head a few times after I saw your
original reply. This is why I think we should just get rid of VB
altogether. *ducks* (just kidding, of course.)
-mbray
Hi Michael,
ROFL. Many a serious word spoken in jest.
Presumably you're from a framework group, so welcome to this glimpse of
languages.vb. ;-)
Regards,
Fergus
Thanks. That worked.
Anyway to zoom the image if it is too big to fit in picturebox's current
size? Ideally I would like a zoom level that a user can set, otherwise
whatever is possible.
Thanks
Regards
"Fergus Cooney" <fi******@tesco .net> wrote in message
news:eh******** ******@tk2msftn gp13.phx.gbl... Evening John,
Put a breakpoint on the Image = z line and check the value of z.
You'll find that it's Nothing.
z.FromFile() is calling a <shared> method. It's the same as calling Bitmap.FromFile (..). In other words it doesn't (can't) change z.
What you need is either: Dim z As System.Drawing. Bitmap z = Bitmap.FromFile ("c:\temp\image .gif") or simply Dim z As New System.Drawing. Bitmap ("c:\temp\image .gif")
Regards, Fergus
* "John" <jo**@nospam.in fovis.co.uk> scripsit: PS: picImage is a PictureBox.
Problem solved?
--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
* "John" <jo**@nospam.in fovis.co.uk> scripsit: I am trying to display an image in a dialog using the following code;
Dim frm As New frmImage Dim z As System.Drawing. Bitmap
z.FromFile("c:\ temp\image.gif" )
Use this instead: 'z = Image.FromFile( ...)'
--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Gregory |
last post by:
Hello,
I've managed to build two web pages, one that can display images with
associated text data in a table, and one that can resize and display images
without the text. I'd like to resize the images as I go, without writing
them to disk on the server. Do I need to prepare all of the resized images
before I display the data from the select (which is put into an array by
php). How can I display a resized image in a table, without writing...
|
by: Dalan |
last post by:
At first I was not certain what could cause Access 97 from displaying
most jpeg images, but not all. After further testing, it seemed that
all original images of less than 275 pixels per inch or less would
display, but those close to 300 pixels/inch or greater would not (MS
Access cannot recognize the file format xxx.jpg). The larger, original
images were scanned and saved as .bmp (at 300 dpi producing a 15MB
file). Then the images were...
|
by: marvin |
last post by:
Hi,
I am trying to display images in a repeater from a SQL database and do
some transformations on the image prior to displaying them (such as
thumbnail with a shadow). The problem is I can't seem to get the data
passed to the handler.
The following is the code that I have so far.
In the ViewPics.aspx file I have...
|
by: CD |
last post by:
An application is logging faxes sent in SQL2000 image column type. I have
found code on the net but what it is doing is prompting to save to local
which is fine for single page image. Not good for multiple page faxes. I
have not been able to locate an example to load in the browser or how to
handle multiple image in the one column.
1) Ideally it would be nice to display back in the browser since some may be
multiple images. I am not...
|
by: ljuljacka |
last post by:
I'm trying to display resized images. Locations of images are fetched from
database. The problem is that with the following code, I get only the first
image displayed:
<?php
header('Content-type: image/jpeg');
$link = mysql_connect('localhost', 'root', '');
if (!$link) {
| |
by: redpears007 |
last post by:
Hi Again,
Throwing this one out to you again as i am not getting anywhere and
can find little to no information out there.
I am currently displaying images (Jpegs) in access via the routine set
up in the article http://support.microsoft.com/kb/285820/en-us. It
works fine if the image is under 1000x1000 pixels. It is set up so
the user can double click to open the image in its host application.
|
by: littlealex |
last post by:
IE6 not displaying text correctly - IE 7 & Firefox 3 are fine! Need some help with this as fairly new to CSS!
In IE6 the text for the following page doesn't display properly - rather than being aligned to the top, along with the slideshow and link buttons, you have to scroll down to see the text - how can I make IE6 display correctly?
http://geekarama.co.uk/new_home.html
here is the code for new_home.html and following that the CSS...
|
by: shahidrasul |
last post by:
i display a pic on picture box and then i want to display another pic after some seconds
but problem is that first image is not displaying only display 2nd image
1... display first picture from database such as
pbThumbImage.Image = new Bitmap(new MemoryStream(objEmployee.Picture));
2... and then get the reference of current main thread
Thread main = Thread.CurrentThread;
Thread.Sleep(5000);
|
by: Jeff |
last post by:
hi
asp.net 2.0
I have a image (.jpeg) stored in sql server 2005 and now I want to display
it on a webpage.
So I created a webpage (Image.aspx) which just writes the buffer data to the
Response object.
On Default.aspx I use this Image.aspx for displaying the image, but no image
|
by: mvijayrkumar |
last post by:
Hi to all....
Guys pls help me.....
I have an image issue in RLDC while hosting my project on server.The image displays or works fine with the local system.But when hosted on server,both the images(One coming from DataSet and another from my project image folder) not displaying.
Both images are having Type property External and the Values are given correspondingly.ie The One coming from Image Folder;using the Report Parameter ,the...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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...
|
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...
|
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,...
|
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...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
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...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |