Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Kinda stupid question but....
Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
Goto page 1, 2  Next
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Remm




PostPosted: Thu Sep 21, 2006 4:45 pm   Post subject: Kinda stupid question but....

Yeah... the referance in the vb help is ultimately useless, for it wont give me somthing like '6.0 help' (all i see is links to other things Confused )
So, here comes the ultimately stupid question:
--> How do I load a second fourm. I want it so that when mr button is clicked, it closes the first form and opens the second.

Thanks, lol
Sponsor
Sponsor
Sponsor
sponsor
Silent Avenger




PostPosted: Thu Sep 21, 2006 4:57 pm   Post subject: (No subject)

Well if you want to make a form visible and invisible here's sample code for it>
code:
Form2.visible = true
Form1.visible = false

or
code:
show Form2
hide Form1

The first one I find more reliable because I've had problems with the second one before. I'm not sure if that's what you're after I hope it is and if you're trying to generate a form I don't know how to do that.
Remm




PostPosted: Thu Sep 21, 2006 5:25 pm   Post subject: (No subject)

Woo, it worked, ty Smile
Remm




PostPosted: Thu Sep 21, 2006 6:03 pm   Post subject: (No subject)

Agh... how do you make it so pictures (such as sprites) are set up so the background colors are reverted to whatever the fourm's background is... like turing's picMerge
Thanks again!
Silent Avenger




PostPosted: Thu Sep 21, 2006 6:11 pm   Post subject: (No subject)

I'm not sure but I'll try to find out for you.
Remm




PostPosted: Thu Sep 21, 2006 6:23 pm   Post subject: (No subject)

Thanks, I really wish there was some more in depth help on this, but the program itself doesnt even provide legable stuffs. Anyways, I have a module. Is it automatically connected to existance or do I have to manually connect it to each form?

Also, its saying that you must give variables values only in procedures. is there any way around this?

Does option explicit REALLY stop vb from making its own variables? i have my doubts...
Silent Avenger




PostPosted: Thu Sep 21, 2006 6:51 pm   Post subject: (No subject)

Your module should be automatically connected. I know I've never had to do it manually. I don't think there is a way around giving variables values only in procedures. I try to see if there is a way around it but I don't think there is. As for Option Explicit, if I remember right from my grade 10 computer science class, I think it is for fixing any minor errors you have in your code I'm not 100% on this but I'm pretty sure that it doesn't stop VB from making its own variables.
Silent Avenger




PostPosted: Thu Sep 21, 2006 8:17 pm   Post subject: (No subject)

I've asked some people and everyone I've asked has said that you can't give variables values outside of precedures. I'm going to ask my uncle(he's a programmer) when I get in contact with him to make sure this is true. I've also been looking around and asking people about the picture thing and I haven't found anyone who knows about it. I'm not quite sure what you're after but if let's say you want an object to appear to have no background on your form just make a picture with a backgroung with the same colour as your form will be or if you have Photoshop you should be able to make a *.gif file and "delete" the background so that it is invisible and anything behind the picture backgound will appear. If that's not exactly what you need just tell me what byou're trying to do and I should be able to get an answer to your question.
Sponsor
Sponsor
Sponsor
sponsor
NikG




PostPosted: Thu Sep 21, 2006 9:26 pm   Post subject: (No subject)

The purpose of Option Explicit is to force the programmer to declare all variables that are used. Without it, you could get away with creating on-the-spot variables (i.e. a = 50 instead of dim a as integer, a = 50). It promotes good/clean programming.

As Silent Avenger mentioned, you need to use transparent gifs. I do not believe vb can do something like picMerge. You CAN NOT just change the bg color of the sprite to be the same as the form because you will notice overlap when two sprites come next to each other.
NikG




PostPosted: Thu Sep 21, 2006 9:32 pm   Post subject: (No subject)

Sorry, forgot to mention 1 thing.

The reason you cannot change variables outside of procs is obvious. Think about it... visual basic functions by calling certain blocks of code at certain times (form_load, form_mousedown, button_click...). If you have some loose piece of code, when would it execute? How would you be able to control when the variable's value changed?
Silent Avenger




PostPosted: Thu Sep 21, 2006 9:47 pm   Post subject: (No subject)

Ahh now I remember what Option Explicit is for. Thanks NikG. Oh and Remm listen to NikG he's right and his explination is more clear than anything I would tell you.
Remm




PostPosted: Tue Sep 26, 2006 2:55 pm   Post subject: (No subject)

Thanks all
Hehe.. im kinda getting a (insanely big) headstart on my final project... doesnt seem to be doing me too much good, seeing as how i dont even kno how to do a good portion of the stuffs. I guess i'll just leave it for a month or 2 and come back to it again...
But how do you get it so that you have your picture ( in this case, a sprite) so that the background around the picture simply reverts to whatever is behind it? (such as the form's picture)
Silent Avenger




PostPosted: Tue Sep 26, 2006 3:45 pm   Post subject: (No subject)

Well if you have photo shop you should be able to "delete" the background and make a *.gif picture file. If you do this and put the picture or sprite in your case in a in an image box the background will be invisible and anything behind it will show through. I think there are other programs that will allow you to remove the background in a *.gif picture file but I'm sure photo shop has a trail version of their program so you could use that. If you need any more help just ask.
Silent Avenger




PostPosted: Tue Sep 26, 2006 4:55 pm   Post subject: (No subject)

Sorry for posting twice. I found some tutorials for you Remm I think you might find them helpful. Your school should have a version of photo shop you can do transparent backgrounds with.

http://powerretouche.com/Transparency_plugin_tutorial.htm#tutorial
http://www.absolutecross.com/tutorials/photoshop/basics/transparent-gifs/

Here's a complete list of tutorials for doing this: http://good-tutorials.com/search/query/transparent
NikG




PostPosted: Tue Sep 26, 2006 9:58 pm   Post subject: (No subject)

A good free (for home users) program that can make transparent images is the FastStone Image Viewer for Windows available at http://www.faststone.org/. If you decide to use that and need some help creating transparent images, let me know and I'll try and help.
Display posts from previous:   
   Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 2  [ 17 Posts ]
Goto page 1, 2  Next
Jump to:   


Style:  
Search: