|
-
May 16th, 2012, 04:16 PM
#1
Thread Starter
New Member
Multiple Forms Opening When Not Desired
Okay, so here's my problem. I have a group of buttons all with different labels. I want to have each of these specific buttons open up the same form, but my problem is when I write the code of form1.show it pops open twenty or so different windows. How to I make one button open just one window? Thanks for the help!
-
May 16th, 2012, 04:21 PM
#2
Addicted Member
Re: Multiple Forms Opening When Not Desired
Which form are you putting this on and can you post the code itself?
-
May 16th, 2012, 07:50 PM
#3
Re: Multiple Forms Opening When Not Desired
We're not mind readers nor are any of us sitting in your lap (at least I hope not) so we can't see what you're seeing. Which includes the code... there could be a number of reasons for this, but we won't know which one it is until you post your code.
-tg
-
May 16th, 2012, 08:03 PM
#4
Thread Starter
New Member
Re: Multiple Forms Opening When Not Desired
You'll have to bare with me. This is all new to me. So I do appreciate the help though.
Public Class TrnTimeTable
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub trn1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles trn1.Click
frmContact.Visible = True
End Sub
End Class
That's my code. And I'm using the Windows Form App
-
May 16th, 2012, 08:10 PM
#5
Thread Starter
New Member
Re: Multiple Forms Opening When Not Desired
Public Class frmContact
Private Sub frmContact_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim oForm As frmContact
oForm = New frmContact()
oForm.Show()
oForm = Nothing
End Sub
End Class
And that's the code I'm using for my second form I'm attempting to open within my button
-
May 16th, 2012, 08:41 PM
#6
Re: Multiple Forms Opening When Not Desired
unfortunately that's not what you're doing... you're actually using the timer to open the forms.
The code that you have in the Load event is what should be behind the click event of the button, with a small change.
Code:
Public Class TrnTimeTable
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oForm As frmContact
oForm = New frmContact()
oForm.Show()
End Sub
That's it... that's all you really need.
-tg
-
May 16th, 2012, 09:10 PM
#7
Thread Starter
New Member
Re: Multiple Forms Opening When Not Desired
Yep, that fixed it. Thanks a lot, I really appreciate it! Now I can get to figuring out how to make buttons disappear when you hit a submit button.
-
May 16th, 2012, 10:46 PM
#8
Addicted Member
Re: Multiple Forms Opening When Not Desired
Should be easy
Button2.hide()
or
Button2.Show()
-
May 16th, 2012, 10:57 PM
#9
Re: Multiple Forms Opening When Not Desired
.Visible property.... as a design note though... typical users hate things showing & hiding themselves... it's something of an aberrant behavior. Enabling/Disabling will make better sense to them... then again... it all depends on the context.
-tg
-
May 16th, 2012, 10:57 PM
#10
Thread Starter
New Member
Re: Multiple Forms Opening When Not Desired
Not sure it'll be that easy, as I have 28 buttons that all open the same contact form, unless I made 28 duplicates of the same contact form, which I guess I could do, just seems like kinda a hassle.
-
May 16th, 2012, 11:01 PM
#11
Re: Multiple Forms Opening When Not Desired
woah.... 1) why so many buttons... and 2) why so many buttons that all do basically the same thing?
-tg
-
May 16th, 2012, 11:17 PM
#12
Thread Starter
New Member
Re: Multiple Forms Opening When Not Desired
It's a calendar que type deal, and they all gotta open the same basic template, which I could I guess make the same template and just have 28 different ones. And the buttons are separate times for people to schedule things at work. No one else is really interested in fixing our broken system, so I'm taking it upon myself to try and make it work. You've been a huge help in this, so I do appreciate it.
-
May 16th, 2012, 11:52 PM
#13
Re: Multiple Forms Opening When Not Desired
Have you considered using a calendar rather than so many buttons?
-
May 17th, 2012, 09:56 AM
#14
Thread Starter
New Member
Re: Multiple Forms Opening When Not Desired
I wasn't aware that was even an option....but we have a calendar currently and it's kinda screwy, so I'll probably stick with what I have currently. I've figured out how to make the cancel buttons and all that work. Just not to make the time button be disabled via clicking the submit button.
-
May 17th, 2012, 12:52 PM
#15
Re: Multiple Forms Opening When Not Desired
-
May 17th, 2012, 02:58 PM
#16
Thread Starter
New Member
Re: Multiple Forms Opening When Not Desired
Thanks Data. I actually found a couple work arounds with Form.Button.Show and Button.Hide I appreciate everyones help though!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|