Click here to Skip to main content
14,386,804 members
Rate this:
Please Sign up or sign in to vote.
See more: (untagged)
I want to change the form size when form_load event fires,
the default size is 900,700 i want to change according to system type
the another size is 700,500

the present code
In app config:<pre lang="C++">&lt;add key=&quot;SystemType&quot; value=&quot;1 or 2&quot; /&gt;</pre>


<pre>Private Sub EmplTimeCard_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If SystemType = 1 Then
'ScreenResolution()
Me.Size = New Size(700, 500)
End If

End Sub</pre>

The problem is error in app config and the size was not changing it showing
1024,724

please help me

i have updated my code with the solution you has sent
still im facing problem
the size form is not changing
please send new code that the form size shoulb be change
according to system.

[edit]Code block added, "Ignore HTML..." option disabled - OriginalGriff[/edit]
Posted
Updated 7-Aug-19 5:46am
v4
Comments
Prerak Patel 24-May-11 3:01am
   
not clear...

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

Your app config file shows the SystemType is "1 or 2".
Your test compares SystemType with "1".

1 is not the same as "1 or 2".

Therefore your test will fail, and you will not change the size of the screen.

Try changing it a bit:
<add key="SystemType" value="Type1" />

Private Sub EmplTimeCard_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            If SystemType = "Type1" Then
                'ScreenResolution()
                Me.Size = New Size(700, 500)
            End If

End Sub

You should be able to work it out from there...:laugh:
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100