so the code; "Dim SecondForm As New form2 SecondForm.Show()" Will open form2 in a new window. what statement do i use if i want to open it within the preexisting window of form1?
If I got what you meant... I dunno how to do that!!! I'd say it's impossible!!! Did you try searching on Ggle?
yeah ive been googling for about an hour now. maybe its not possible. what i mean, is like a web link, will open the next page where the page was before. I guess I could just use the close window function. which is probably easier another thing, how do you link a question box to open a form? i can get a button to do it, easy enough, but for example when it pops up with "yes" and "no", can i get the yes to link to another form? closing the form already open? hope that makes sense
Yes, sure. Messageboxes return values depending on the button which is pushed. Values: OK = 1 Cancel = 2 Terminate = 3 Retry = 4 Skip(Ignore) = 5 Yes = 6 No = 7 So, use this code: Code (Text): Dim intYesNo as Integer intYesNo = MsgBox("Do you want to open the next form?", vbYesNo) If intYesNo = 6 Then 'If Yes(6) button is pressed, it executes this code frmExample.Show Else End 'this will end the program, change it to whatever you want End If
ok i have another problem Code (Text): Private Sub PictureBox7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox7.Click Dim submit As Integer TextBox1.Text = submit Dim wrong As New main Dim correct As New Success If submit < 94000 Or submit > 99000 Then wrong.Show() Else correct.Show() End If End Sub now theoretically when you enter a value less than 94000, or greater than 99000 in the text box and click the picture it should go to "main" and when the value in the text box is between those two (e.g 96000) it should go to "success" now, i'm not sure how to get the "if something is less than a given value" because the less than sign (<) doesn't give the procedure i'm looking for. and ideas on what it may be?
Is submit an integer or a string? If it is a string, use the Code (Text): Int(*here the string*) code. It converts a string to a numeric value.
doesnt Code (Text): Dim submit as integer doesnt that make sure "submit" is an integer? thats not the problem. its the case of directing the button to another form depending on what is entered into the box
Then the code you posted should work. If you aren't sure if it works, just use a label to check the value of the submit variable. You will see if the code works properly.