Advertisement

04.07.2008 at 10:49AM PDT, ID: 23302146
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.8

vb.net 2005, A form which is inside a panel of another form, the width/height seems to be locked, why can't I change them?

Asked by JeffreyDurham in .NET, Microsoft Visual Basic.Net

Dear Experts:

I love this service, as it is especially ideal for asking rather strange and specific questions. This is one that's kinda important to me, but I don't understand why it's happening.

I've got this form, which I have opened inside of another form, I have a main form, which holds my other forms, and it's got a menu (of buttons) on the left. anyways, it's nice, but one thing I want to be able to do is when I resize the main form I want to be able to resize my inner form. For some reason, whenever I do this, even though the events are triggered to resize it, the properties do /not/ change. I set them, and then read them and they are the same as before.

Here is my code for how I setup the form and how I call the resize on the other form.
The part you should especially note is formDataGrid.form2_resize() which is in the second class. There you can see where I set the width and height and then where I debug.print it is where I would expect those values to change.

Does anyone know what might be going on?
Thanks Experts! ~Michael

Start Free Trial
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:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
Public Class mainForm
    Public formInForm As Object
    Public formLoadedInForm$
 
    Public Sub New()
        InitializeComponent()
        OpenNewForm(formDataGrid)
    End Sub
 
    Public Sub OpenNewForm(ByVal sForm As System.Windows.Forms.Form)
        'Me.SplitContainer1.Panel2.Controls().Clear()
 
        formInForm = sForm
        formLoadedInForm = sForm.Name.ToLower
        With formInForm
            .toplevel = False
            Me.SplitContainer1.Panel2.Controls.Add(formInForm)
            CenterInnerForm()
            If .Visible = False Then sForm.Show() Else sForm.Focus()
        End With
    End Sub
 
    '-->    This calls the Routine in Question
    Private Sub Main_ResizeEnd(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.ResizeEnd
        If formLoadedInForm = "formdatagrid" Then
            formInForm.Form2_Resize(sender, e)
        End If
    End Sub
 
    Public Sub CenterInnerForm()
        Dim myRect As System.Drawing.Rectangle
        With formInForm
            If formLoadedInForm <> "" Then
                myRect = Me.SplitContainer1.Panel2.Bounds
                .Left = (myRect.Width - .width) / 2 '(.Right - .Left)) / 2
                .Top = (myRect.Height - (.Bottom - .Top)) / 2
            End If
        End With
    End Sub
End Class
 
Public Class formDataGrid
    '-->    This is the Routine in Question
    Public Sub Form2_Resize(ByVal sender As System.Object, _
        ByVal e As System.EventArgs) Handles MyBase.Resize
 
        Dim frm As Form = Me 'Me.MdiParent
        If frm Is Nothing Then Exit Sub
 
        If sender.name = "mainForm" Then
            Debug.Print(mainForm.SplitContainer1.Panel2.Width & ", " & mainForm.SplitContainer1.Panel2.Height)
            'frm.FormBorderStyle = Windows.Forms.FormBorderStyle.Sizable
            Me.Width = mainForm.SplitContainer1.Panel2.Width
            Me.Height = mainForm.SplitContainer1.Panel2.Height
            Debug.Print(Me.Width & ", " & Me.Height)
        End If
 
        If Me.WindowState = FormWindowState.Maximized Then
            frm.FormBorderStyle = Windows.Forms.FormBorderStyle.None
        End If
 
        If Not Me.WindowState = FormWindowState.Minimized Then
            Me.mydatagrid.Left = 0 '4
            Me.mydatagrid.Top = 0 '4
            Me.mydatagrid.Width = Me.Width ' - 10
            Me.mydatagrid.Height = Me.Height - Me.BindingNavigator1.Height
        End If
    End Sub
End Class
[+][-]04.07.2008 at 01:15PM PDT, ID: 21300175

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.07.2008 at 01:31PM PDT, ID: 21300306

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.07.2008 at 01:45PM PDT, ID: 21300405

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]04.07.2008 at 01:59PM PDT, ID: 21300523

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]04.07.2008 at 02:01PM PDT, ID: 21300545

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]04.08.2008 at 01:19PM PDT, ID: 21309176

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: .NET, Microsoft Visual Basic.Net
Sign Up Now!
Solution Provided By: JeffreyDurham
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628