home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

VB.NET: Run loading wrong form

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 2081
Discussions: 200,919, Posts: 2,379,045, Members: 246,287
Old October 10th, 2002, 01:55 AM   Digg it!   #1 (permalink)
Ordained Mommy
 
NeoStarO1's Avatar
 
Join Date: Oct 2001
Location: Big Sky Country
Posts: 4,259
Blog Entries: 1
VB.NET: Run loading wrong form

Okay this is my problem, qutie simple, code two opens the form of code 1 and I don't want that.
Basically what I am doing as I go through the book is im following along and creating the forms as I go along all in one project. But my problem is that i want the code to open up the approperaite
form and not the main form. How do i do this? its really a pain in the arse to delete all code then delete what I got in my form window and start over again, when later in the chapter
i need to go back to that example and add other code and then im back at repeating doing that all over again.

soooooo how do I keep the codes to that form to open that form and not the orignal first form?
here is the sample codes im using. Yes I added the line of windows stuff as well just not all that is inside the +.

TIA
Karin


Code:
Public Class frmAddition
    Inherits System.Windows.Forms.Form

+Windows Form Designer generated code


    Private Sub btnCompute_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCompute.Click
	
Dim sum As Double
        sum = CDbl(txtFirstNum.Text) + CDbl(txtSecondNum.Text)
        txtSum.Text = CStr(sum)
    End Sub
End Class
Code:
Public Class frmExample3
    Inherits System.Windows.Forms.Form

+Windows Form Designer generated code

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
        Dim quote1, quote2, quote As String
        quote1 = "The ballgame isn't over, "
        quote2 = "untill its over."
        quote = quote1 & quote2
        txtOutput.Text = quote & "     Yogi Berra"
    End Sub
End Class
NeoStarO1 is offline   Reply With Quote
Old October 10th, 2002, 02:21 AM     #2 (permalink)
Not Really a Member
 
Join Date: Oct 2001
Posts: 25,382
on the project name on the right side explorer, right click and hit properties. In there somewhere should be the startup properties. SEe if you can change the default to open up.
__________________
Helicopters don't fly; they vibrate so much and make so much noise that the earth rejects them.
vass0922 is online now   Reply With Quote
Old October 10th, 2002, 02:25 AM     #3 (permalink)
Ordained Mommy
 
NeoStarO1's Avatar
 
Join Date: Oct 2001
Location: Big Sky Country
Posts: 4,259
Blog Entries: 1
Yes that is what i discovered just now before reading your post, but what doesn't make sense to me that if you have several forms in a project you have to change the startup properties each time you wnat to run the code in that form.

That seems like a pain and I don't see how in the future that could be good. I am wondering its related to another known bug.

So how do I make to so I don't have to change the startup properties each time for each form i wnat to load?


edit:
Quote:
***Deleted quote*** As it is not same thing is bug but not related to this problem.


Last edited by NeoStarO1 : October 10th, 2002 at 02:28 AM.
NeoStarO1 is offline   Reply With Quote
Old October 10th, 2002, 02:32 AM     #4 (permalink)
Member
 
Join Date: Sep 2002
Posts: 364
You can't run code in multiple forms as standalone because only one class can have a main() method.
Creosote is offline   Reply With Quote
Old October 10th, 2002, 02:34 AM     #5 (permalink)
Not Really a Member
 
Join Date: Oct 2001
Posts: 25,382
No you don't change forms in the properties to show different forms. That setting only changes the STARTUP form.
From there you call code in the startup form to open the 2nd form.

Definately not a bug
vass0922 is online now   Reply With Quote
Old October 10th, 2002, 02:39 AM     #6 (permalink)
Member
 
Join Date: Sep 2002
Posts: 364
Vass--I think her frustration has to do with that fact that a Windows application automattically adds a form with a main method.

Now what I have done at times is delete the main method if I have started with a Windows app, make an empty class with a main, and then show a form. Sometimes a form may or may not need to be shown for whatever reason.
Creosote is offline   Reply With Quote
Old October 10th, 2002, 02:40 AM     #7 (permalink)
Ordained Mommy
 
NeoStarO1's Avatar
 
Join Date: Oct 2001
Location: Big Sky Country
Posts: 4,259
Blog Entries: 1
Quote:
Originally posted by vass0922
No you don't change forms in the properties to show different forms. That setting only changes the STARTUP form.
From there you call code in the startup form to open the 2nd form.

Definately not a bug

What do you mean call code?

Meaning i need to stay at orignal form code window and call form to second set of codes inserted in code one with a call ?
NeoStarO1 is offline   Reply With Quote
Old October 10th, 2002, 02:44 AM     #8 (permalink)
Not Really a Member
 
Join Date: Oct 2001
Posts: 25,382
well that's fine, but she's still learning programming and following a book so let her follow the book and not try to confuse things further lol.

So you gotta have one startup form, and then the startup form calls the 2nd form on some sort of event or some sort of code.
vass0922 is online now   Reply With Quote
Old October 10th, 2002, 02:51 AM     #9 (permalink)
Ordained Mommy
 
NeoStarO1's Avatar
 
Join Date: Oct 2001
Location: Big Sky Country
Posts: 4,259
Blog Entries: 1
Quote:
Originally posted by vass0922
well that's fine, but she's still learning programming and following a book so let her follow the book and not try to confuse things further lol.

So you gotta have one startup form, and then the startup form calls the 2nd form on some sort of event or some sort of code.

First half of quote, thank you very much Vass

Okayyyyyyyyy on second part. um Huh? LOL I understand what you mean just not sure how to write that, I do know how call function works when you call something but we haven't done it yet to call another form yet. I guess im getting ahead of myself here.

I think maybe for tonight stick with the um changing the start up properties for now till i got more time to play with makeing a call from one form to another.

I do know that by the end of the course we will have to have some sort of basical fully functioning program created.

okay im off to bed. its late.
NeoStarO1 is offline   Reply With Quote
Old October 10th, 2002, 02:55 AM     #10 (permalink)
Not Really a Member
 
Join Date: Oct 2001
Posts: 25,382
for instance to show a 2nd form in my app I have something like...

Dim fSplash As New frmSplash()

fSplash.Show()
now one way to call code in teh 2nd form is to put stuff in the Form Load event .. not hte classiest code but it'll work
vass0922 is online now   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (2846)
Obama the Muslim (11)
Why is Khalid Sheikh Mohammed even .. (9)
Is the PSU I received dead? (10)
windows vista security holes (7)
Foreign voltage (10)
HIS HD5770 graphic card question (15)
Install XP pro and a Vista laptop ?.. (9)
A good PSU? (10)
Dept. of HS: NSA 'Helped' Develop V.. (15)
Print spooler problem (10)
New Computer wont recognize XP disc (7)
Ideal cheap graph card for PC-Gamin.. (15)
EVGA 9800 gtx help with finding a g.. (8)
Recent Discussions
Foreign voltage (10)
FiOS modem/router interfering with ne.. (7)
Browsers wont load websites (2)
Virus Doctor Popup? (1)
Help getting around port 80 for camer.. (1)
[F@H SPAM 11/16/09] ! 1/2 months to r.. (31)
Dept. of HS: NSA 'Helped' Develop Vis.. (15)
windows vista security holes (7)
Install XP pro and a Vista laptop ?? (9)
EVGA 9800 gtx help with finding a goo.. (8)
Modern Warfare For the PC (32)
Problem with speed step/turbo boost? (1)
monitor will not turn on at all, (0)
Modern Warfare 2: Who Bought It? (61)
World's largest Monopoly Game using G.. (330)
Print spooler problem (10)
SIS 740 and Widescreen (8)
Baffling Problem with my CPU/MoBo's. .. (0)
Display shows 3x5 inch in middle of s.. (0)
HIS HD5770 graphic card question (15)
Best file format to play on Windows H.. (0)
PSP Go bought in Japan (0)
Asus P4G8X Mobo (3)
Need hard disk drivers (4)
windows 7 internet problem (4)


All times are GMT -4. The time now is 06:45 PM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28