Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » General

Post new topic   Reply to topic
Declare image as constant
View previous topic :: View next topic  
Author Message
timmy
Newbie


Joined: 08 Dec 2003
Posts: 5

PostPosted: Jan 12th, 2004 01:05 PM    Post subject: Declare image as constant Reply with quote

I am having a world of troubles, trying to declare an image as a constant. I've been trying something along the lines of:

Const imgon=frmgame.imglight(index).Picture=LoadPicture("lighton.gif")

Anyone have ideas of how I'd do this?
Back to top
View user's profile Send private message Send e-mail AIM Address
P.T.A.M.
Administrator


Joined: 08 Oct 2003
Posts: 752
Location: Greece

PostPosted: Jan 12th, 2004 04:16 PM    Post subject: Reply with quote

A constant is something that can't change... Using a property of a control is therefore not possible (I think)... There might be another way for what you are trying to do... Why is this needed?
_________________
No one is completely useless. They can at least be an example of what to avoid.
Back to top
View user's profile Send private message Send e-mail Visit poster's website ICQ Number
timmy
Newbie


Joined: 08 Dec 2003
Posts: 5

PostPosted: Jan 12th, 2004 04:51 PM    Post subject: Reply with quote

I'm using it for a Lights Out program I have to make for my final program in class. I didn't want to have to have an array for when the lights were on, and one for when they were off, so I wanted to make an integer that equaled the on or off picture. I got it figured out though, thanks all.
Back to top
View user's profile Send private message Send e-mail AIM Address
P.T.A.M.
Administrator


Joined: 08 Oct 2003
Posts: 752
Location: Greece

PostPosted: Jan 12th, 2004 05:48 PM    Post subject: Reply with quote

What did you do after all? If you read the file as binary and set that data as your constant you can afterwards write that data to a temp file and use that...
_________________
No one is completely useless. They can at least be an example of what to avoid.
Back to top
View user's profile Send private message Send e-mail Visit poster's website ICQ Number
timmy
Newbie


Joined: 08 Dec 2003
Posts: 5

PostPosted: Jan 14th, 2004 12:03 PM    Post subject: Reply with quote

I ended up having to add the following code to my program...

Public Const lighton = "lighton.gif"
Public strimage As String
strimage = App.Path & "\Pics\"

And I referred to it like this...

frmgame.imglight(x).Picture = LoadPicture(strimage & lighton)
I also had to use Tags
Back to top
View user's profile Send private message Send e-mail AIM Address
P.T.A.M.
Administrator


Joined: 08 Oct 2003
Posts: 752
Location: Greece

PostPosted: Jan 14th, 2004 12:26 PM    Post subject: Reply with quote

Why did you need the tags? It works the way it is now...
_________________
No one is completely useless. They can at least be an example of what to avoid.
Back to top
View user's profile Send private message Send e-mail Visit poster's website ICQ Number
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » General All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic