I was trying to create a random image generator. I'm using visual web dev
express with 2.0 framework.
On the web form page (mypage.aspx), I have an image control:
<asp:Image ID="Image1" runat="server" />
On the codebehind, (mypage.aspx.vb ), I have this code when a button is
clicked:
Dim imagegen() As String
Dim x As Short
x = CShort(Rnd() * 15)
imagegen(0) = "../images/ticketimages/atlascow.jpg"
imagegen(1) = "../images/ticketimages/carpool.bmp"
imagegen(2) = "../images/ticketimages/catsquirrel.jpg "
imagegen(3) = "../images/ticketimages/creature.jpeg"
imagegen(4) = "../images/ticketimages/fitnessescalato r.bmp"
imagegen(5) = "../images/ticketimages/frogcat.jpg"
imagegen(6) = "../images/ticketimages/helicopter.jpg"
imagegen(7) = "../images/ticketimages/highheelbike.bm p"
imagegen(8) = "../images/ticketimages/kisspandas.jpg"
imagegen(9) = "../images/ticketimages/libertylegs.jpg "
imagegen(10) = "../images/ticketimages/portapotty.bmp"
imagegen(11) = "../images/ticketimages/rabbitfingers.j pg"
imagegen(12) = "../images/ticketimages/santaplane.bmp"
imagegen(13) = "../images/ticketimages/sharkattack.jpg "
imagegen(14) = "../images/ticketimages/swissarmyant.jp g"
imagegen(15) = "../images/ticketimages/whaletail.jpg"
Image1.ImageUrl = imagegen(x)
When I tested the code, I got this error:
Server Error in '/' Application.
--------------------------------------------------------------------------------
Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.NullRefe renceException: Object reference not set
to an instance of an object.
Source Error:
Line 346: Dim x As Short
Line 347: x = CShort(Rnd() * 15)
Line 348: imagegen(0) = "../images/ticketimages/atlascow.jpg"
Line 349: imagegen(1) = "../images/ticketimages/carpool.bmp"
Line 350: imagegen(2) = "../images/ticketimages/catsquirrel.jpg "
Source File: E:\hhsinternal\ Tickets\problem .aspx.vb Line: 348
Stack Trace:
[NullReferenceEx ception: Object reference not set to an instance of an
object.]
problem.btnRepo rtProblem_Click (Object sender, EventArgs e) in
E:\hhsinternal\ Tickets\problem .aspx.vb:348
System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) +105
System.Web.UI.W ebControls.Butt on.RaisePostBac kEvent(String eventArgument)
+78
System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring
eventArgument) +7
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
sourceControl, String eventArgument) +11
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +33
System.Web.UI.P age.ProcessRequ estMain(Boolean
includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint) +5670
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.502 15.44; ASP.NET
Version:2.0.502 15.44
I'm a newbie with asp.net and vb.net. I've come a long ways but it seems
i've got a very long ways to go before I've got a clear understanding of
most of this stuff.
Thanks for the help!
Jim 2 2881
You have not defined the size of the array, therefore imagegen(0) does not
exist.
"Jim in Arizona" <ti*******@hotm ail.com> wrote in message
news:uU******** ******@TK2MSFTN GP12.phx.gbl... I was trying to create a random image generator. I'm using visual web dev express with 2.0 framework.
On the web form page (mypage.aspx), I have an image control:
<asp:Image ID="Image1" runat="server" />
On the codebehind, (mypage.aspx.vb ), I have this code when a button is clicked:
Dim imagegen() As String Dim x As Short
x = CShort(Rnd() * 15)
imagegen(0) = "../images/ticketimages/atlascow.jpg" imagegen(1) = "../images/ticketimages/carpool.bmp" imagegen(2) = "../images/ticketimages/catsquirrel.jpg " imagegen(3) = "../images/ticketimages/creature.jpeg" imagegen(4) = "../images/ticketimages/fitnessescalato r.bmp" imagegen(5) = "../images/ticketimages/frogcat.jpg" imagegen(6) = "../images/ticketimages/helicopter.jpg" imagegen(7) = "../images/ticketimages/highheelbike.bm p" imagegen(8) = "../images/ticketimages/kisspandas.jpg" imagegen(9) = "../images/ticketimages/libertylegs.jpg " imagegen(10) = "../images/ticketimages/portapotty.bmp" imagegen(11) = "../images/ticketimages/rabbitfingers.j pg" imagegen(12) = "../images/ticketimages/santaplane.bmp" imagegen(13) = "../images/ticketimages/sharkattack.jpg " imagegen(14) = "../images/ticketimages/swissarmyant.jp g" imagegen(15) = "../images/ticketimages/whaletail.jpg"
Image1.ImageUrl = imagegen(x)
When I tested the code, I got this error:
Server Error in '/' Application. --------------------------------------------------------------------------------
Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullRefe renceException: Object reference not set to an instance of an object.
Source Error:
Line 346: Dim x As Short Line 347: x = CShort(Rnd() * 15) Line 348: imagegen(0) = "../images/ticketimages/atlascow.jpg" Line 349: imagegen(1) = "../images/ticketimages/carpool.bmp" Line 350: imagegen(2) = "../images/ticketimages/catsquirrel.jpg "
Source File: E:\hhsinternal\ Tickets\problem .aspx.vb Line: 348
Stack Trace:
[NullReferenceEx ception: Object reference not set to an instance of an object.] problem.btnRepo rtProblem_Click (Object sender, EventArgs e) in E:\hhsinternal\ Tickets\problem .aspx.vb:348 System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) +105 System.Web.UI.W ebControls.Butt on.RaisePostBac kEvent(String eventArgument) +78
System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring eventArgument) +7 System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler sourceControl, String eventArgument) +11 System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +33 System.Web.UI.P age.ProcessRequ estMain(Boolean includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint) +5670
-------------------------------------------------------------------------------- Version Information: Microsoft .NET Framework Version:2.0.502 15.44; ASP.NET Version:2.0.502 15.44
I'm a newbie with asp.net and vb.net. I've come a long ways but it seems i've got a very long ways to go before I've got a clear understanding of most of this stuff.
Thanks for the help!
Jim
Yep. That was it exactly!
Thanks!
Jim
"Peter Rilling" <pe***@nospam.r illing.net> wrote in message
news:OQ******** ******@TK2MSFTN GP09.phx.gbl... You have not defined the size of the array, therefore imagegen(0) does not exist.
"Jim in Arizona" <ti*******@hotm ail.com> wrote in message news:uU******** ******@TK2MSFTN GP12.phx.gbl...I was trying to create a random image generator. I'm using visual web dev express with 2.0 framework.
On the web form page (mypage.aspx), I have an image control:
<asp:Image ID="Image1" runat="server" />
On the codebehind, (mypage.aspx.vb ), I have this code when a button is clicked:
Dim imagegen() As String Dim x As Short
x = CShort(Rnd() * 15)
imagegen(0) = "../images/ticketimages/atlascow.jpg" imagegen(1) = "../images/ticketimages/carpool.bmp" imagegen(2) = "../images/ticketimages/catsquirrel.jpg " imagegen(3) = "../images/ticketimages/creature.jpeg" imagegen(4) = "../images/ticketimages/fitnessescalato r.bmp" imagegen(5) = "../images/ticketimages/frogcat.jpg" imagegen(6) = "../images/ticketimages/helicopter.jpg" imagegen(7) = "../images/ticketimages/highheelbike.bm p" imagegen(8) = "../images/ticketimages/kisspandas.jpg" imagegen(9) = "../images/ticketimages/libertylegs.jpg " imagegen(10) = "../images/ticketimages/portapotty.bmp" imagegen(11) = "../images/ticketimages/rabbitfingers.j pg" imagegen(12) = "../images/ticketimages/santaplane.bmp" imagegen(13) = "../images/ticketimages/sharkattack.jpg " imagegen(14) = "../images/ticketimages/swissarmyant.jp g" imagegen(15) = "../images/ticketimages/whaletail.jpg"
Image1.ImageUrl = imagegen(x)
When I tested the code, I got this error:
Server Error in '/' Application. --------------------------------------------------------------------------------
Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullRefe renceException: Object reference not set to an instance of an object.
Source Error:
Line 346: Dim x As Short Line 347: x = CShort(Rnd() * 15) Line 348: imagegen(0) = "../images/ticketimages/atlascow.jpg" Line 349: imagegen(1) = "../images/ticketimages/carpool.bmp" Line 350: imagegen(2) = "../images/ticketimages/catsquirrel.jpg "
Source File: E:\hhsinternal\ Tickets\problem .aspx.vb Line: 348
Stack Trace:
[NullReferenceEx ception: Object reference not set to an instance of an object.] problem.btnRepo rtProblem_Click (Object sender, EventArgs e) in E:\hhsinternal\ Tickets\problem .aspx.vb:348 System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) +105 System.Web.UI.W ebControls.Butt on.RaisePostBac kEvent(String eventArgument) +78
System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring eventArgument) +7 System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler sourceControl, String eventArgument) +11 System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) +33 System.Web.UI.P age.ProcessRequ estMain(Boolean includeStagesBe foreAsyncPoint, Boolean includeStagesAf terAsyncPoint) +5670
-------------------------------------------------------------------------------- Version Information: Microsoft .NET Framework Version:2.0.502 15.44; ASP.NET Version:2.0.502 15.44
I'm a newbie with asp.net and vb.net. I've come a long ways but it seems i've got a very long ways to go before I've got a clear understanding of most of this stuff.
Thanks for the help!
Jim
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Phil Powell |
last post by:
I created a page that will be doing image resizing and manipulation,
which seems to work (using GD library). However, upon returning to
the page where the image has been changed, I still see the old image,
until I refresh my browser and then zappo, there it is! All changed!
I have done everything I can think of to force caching including...
|
by: Ioannis Vranos |
last post by:
I want to create some random numbers for encryption purposes, and i wonder
if the following scheme makes it more hard to guess the underneath number
generation pattern, than the plain use of rand():
#include <stdlib.h>
#include <time.h>
|
by: Dimos |
last post by:
Hello All,
I need some help with random number generation. What I
need exactly is:
To create a few thousand numbers, decimal and
integers, between 5 and 90,
and then to export them as a single column at a
spreadsheet.
|
by: tshad |
last post by:
I am trying to set up an Image authorization where you type in the value
that is in a picture to log on to our site.
I found a program that is supposed to do it, but it doesn't seem to work.
It should put a blue and yellow box on the page with "This is a test" as
part of the picture. But what I get is a broken Gif.
The other problem is...
|
by: skip |
last post by:
Is there a module out there that will generate an image with a random text
string such as the confirmation images you see on various websites? I'm
thinking I'm going to have to add that to the forms on the Mojam websites.
Over the past couple weeks we've begun to get lots of spam submission crap.
Thx,
Skip
| |
by: gagan.singh.arora |
last post by:
Hi there.
I want to generate random numbers with a given probability, say 80%
even and 20% odd. Is it possible to implement such an algorithm in C?
|
by: chico_yallin |
last post by:
I just wana make a random id number based on4 digits-for examples??
Thanks in Advance
Ch.Yallin
|
by: jason.cipriani |
last post by:
I am looking for a random number generator implementation with the
following requirements:
- Thread-safe, re-entrant.
- Produces consistently reproducible sequences of psuedo-random
numbers given a seed.
- Relatively uniform, does not have to be perfect.
The application is not a security or statistics application, the
quality of numbers...
|
by: Fan924 |
last post by:
How do I add random number generation to this background image slide
show? Everything I try kills if. TIA
_____________________________________
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;
charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId"...
|
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...
|
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. ...
| |
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...
|
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...
|
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...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |