Click here to Skip to main content
15,443,549 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
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 4:46am
v4
Comments
Prerak Patel 24-May-11 3:01am    
not clear...

1 solution

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:
XML
<add key="SystemType" value="Type1" />

VB
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:
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900