takowai Posted August 7, 2003 Posted August 7, 2003 I am new to vb so can anyone help me please? I have 3 forms - Menu, Maintenance and View. I want to loan either the Maintenace form or the View form via a button_click on the Menu form. Thanks Quote
Leaders dynamic_sysop Posted August 7, 2003 Leaders Posted August 7, 2003 in the button_Click event : Dim frmMaint As New Maintenace() frmMaint.Show() '/// assuming that Maintenace is the name of the Form. '/// same for the other form. Quote
Dirty Howi Posted August 7, 2003 Posted August 7, 2003 dag nabit, and here i was ready to show off the one thing i know in vb.net and dynamic beat me too it... Quote
takowai Posted August 8, 2003 Author Posted August 8, 2003 Don't worry - I'm sure to come up with more blonde questions as the day progresses!! Quote
takowai Posted August 8, 2003 Author Posted August 8, 2003 I said that I would be back - I have followed your advice but I keep getting "Maintenance not defined" How do I define this please? Quote
*Experts* mutant Posted August 8, 2003 *Experts* Posted August 8, 2003 What is the name of the class that is the form? Use that name. Quote
takowai Posted August 8, 2003 Author Posted August 8, 2003 "Public Class frmMaint" is the name of the Class for the Maintenance Form, "Public Class frmMenu" for the Menu Form and "Public Class frmView" for the View form. Quote
*Experts* mutant Posted August 8, 2003 *Experts* Posted August 8, 2003 Then use this: Dim fMaint As New frmMaint 'of course you call the variable something else than fMaint fMaint.Show() You use frmMaint becuase thats name of the your form class. :) Quote
takowai Posted August 8, 2003 Author Posted August 8, 2003 Hey - It just sunk in what you mean and it works!!!! Thanks soooo much. Quote
takowai Posted August 8, 2003 Author Posted August 8, 2003 Thanks for your help with the forms that I'm setting up. Could you give me just a little more of your time? I can now access the Maintenance form and View form from the Menu form. How do I return to the Menu form when I button_click on Exit from either of the others? Quote
*Experts* mutant Posted August 8, 2003 *Experts* Posted August 8, 2003 What do you mean return? If you just used the code I showed you the Menu form would still be there visible, so if you close the frmMaint form you should still be able to see the Menu form. Quote
takowai Posted August 8, 2003 Author Posted August 8, 2003 No - it brings up another Menu so I now have three forms layered on the screen. Quote
*Experts* mutant Posted August 8, 2003 *Experts* Posted August 8, 2003 So on exit of your frmMaint you create a new instance of your menu form and show it? What is your code on the button_click event handler? There shouldnt be another instance of frmMenu if you didnt create it yourself. Quote
takowai Posted August 8, 2003 Author Posted August 8, 2003 I used the End command - something not advised I know. I then took that out and replaced it with the Dim statement to take me back to the Menu. I know that there is a better way of closing the Maintenance form with the "Nothing" statement but , for the life of me, I just can't find how to use it in any of my reference materials. Quote
Diablicolic Posted August 8, 2003 Posted August 8, 2003 I think I can answer this, :p Ok if you mean like how to like make a form disapear, then go like this: Dim TheFormName As New TheFormName 'Create instance of TheFormName (the form that you want to disapear) TheFormName.Hide I think that's what you mean :) Quote "Reality is fake, Dreams are for real"
ThePentiumGuy Posted August 12, 2003 Posted August 12, 2003 ... why dont u attach the project and we'll try to figure it out Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
ThePentiumGuy Posted August 13, 2003 Posted August 13, 2003 never mind.. u figured it out already in your other post Quote My VB.NET Game Programming Tutorial Site (GDI+, Direct3D, Tetris [coming soon], a full RPG.... you name it!) vbprogramming.8k.com My Project (Need VB.NET Programmers) http://workspaces.gotdotnet.com/ResolutionRPG
chrisgill369 Posted September 18, 2003 Posted September 18, 2003 linking forms i also need some help, i think its quite similar. im making a game and the start menu has 4 command buttons, i want a different form to load up for each command. eg, the game formk to load wen play is pressed and options appear wen options is pressed. all my forms are named as default eg form1, form2 any help would be appreciated thanks Quote
AlexCode Posted September 18, 2003 Posted September 18, 2003 First of all ... don't keep the default Forms names ... next week you'll start your project and will have to open all of them to know what in them... :p Next... I don't know what kind of game you're trying to do but if you have this kind of questions I advise you to read some books before proceding... Bigger troubles are yet to come!! :D Answering your question you just have to put this code (changing only the name of the form you want to open...) in the click event of each button: Dim form1 As New form1 form1.Show() If you want the form to be Modal try this: Dim form1 As New form1 form1.Showdialog() Have fun ... and don't forget my advise... read some good books and mess around with VB.net a little more time! :) Quote Software bugs are impossible to detect by anybody except the end user.
chrisgill369 Posted September 18, 2003 Posted September 18, 2003 lol i have already made the game but in a simpler version. its a game where the computer thinks of a number 1- 1000 and uve gotta guess it rite in ten tries. im trying to improve it by adding more options and i figuered out how to link forms just after i posted the reply but thanks anyway Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.