-
Oct 10th, 2008, 12:52 PM
#1
Thread Starter
Junior Member
[2008] User Control Button To Open New Form
I am trying to create a User Control Button that will allow a button to be dropped on the form, then set the FormToOpen property with the form in the project that you want to Show. Here is what I have so far, but it doesn't seem to work this easy:
Code:
Public Class OpenWindowButton
Inherits Button
Private m_FormToOpen As Form
Public Property FormToOpen() As Form
Get
Return m_FormToOpen
End Get
Set(ByVal value As form
m_FormToOpen = value
End Set
End Property
Private Sub m_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Click
Dim NewForm As typeof(m_FormToOpen)
NewForm.Show()
End Sub
End Class
-
Oct 10th, 2008, 01:05 PM
#2
Frenzied Member
Re: [2008] User Control Button To Open New Form
-
Oct 10th, 2008, 01:10 PM
#3
Thread Starter
Junior Member
Re: [2008] User Control Button To Open New Form
Originally Posted by Besoup
m_FormToOpen.Show
That gets rid of my errors, but now my problem is setting which form to open in the property window. Although I have 2 forms in my project, I only get the form on which the button resides as the selection in the drop down box.
-
Oct 10th, 2008, 01:12 PM
#4
Frenzied Member
Re: [2008] User Control Button To Open New Form
can you post the code that is setting the form to the button?
-
Oct 10th, 2008, 01:20 PM
#5
Thread Starter
Junior Member
Re: [2008] User Control Button To Open New Form
Originally Posted by Besoup
can you post the code that is setting the form to the button?
There is no more code than what is above. I created a new project, added a new class, then added the code above to the new class. I then build the project.
I can then drag and drop the OpenWindowButton on the form (Class with code above), then go to the properties window for the button and set the FormToOpen property. In that property list, I need it t show all forms in the project, but it only shows 1.
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
|