Event Handling Screen Orientation

PCgeek

New member
Joined
Mar 13, 2008
Messages
4
Location
Perth, Australia
Programming Experience
Beginner
Hi Guys,

I've at last found what looks to be a great forum for VB.Net dev!!!
I'm fairly new (about 12 months) to vb.net having done a short course at school last year. I've taken another step and have made a small app for windows mobile 5 with the MS SDK.

This app loads an XML document into a dataset, and searches the dataset based on the input from a used. It has two funtions; search via number and search via name. I use an imate K-Jam so when i slide the keyboard out the device screen orientation changes to 270 degrees.

I need some way of dectecting when the keyboard slides out becuase i want my program to change funtions. How would i write an event handler to manage screen orientation change??

So when the screen orienation changes to 270 degrees.
The class is Microsoft.WindowsCE.forms.SystemSettings.ScreenOrientation.Angle270

All i want to happen is some code to run when this event is triggered.

All help is appreciated...

Many Thanks,

Tim
 
Use the form Resize event.

VB.NET:
Private Sub MyForm_Resize(ByVal sender As Object, ByVal e As EventArgs)
    If (SystemSettings.ScreenOrientation = ScreenOrientation.Angle270) Then
       'run code here
    End If
End Sub
 
nope... it doesn't execute the code...

VB.NET:
Private Sub Form1_Resize(ByVal sender As Object, ByVal e As EventArgs)
        If Microsoft.WindowsCE.Forms.SystemSettings.ScreenOrientation = Microsoft.WindowsCE.Forms.ScreenOrientation.Angle90 Then
            fname.Show()
            sname.Show()
            tb2.Show()
            butGOName.Show()
.
.
.
Else If Microsoft.WindowsCE.Forms.SystemSettings.ScreenOrientation = Microsoft.WindowsCE.Forms.ScreenOrientation.Angle0 Then
            but1.Show()
.
.
.
End If 
End Sub

have i done something wrong??
I know the event isn't firing because i added in a message box to show me that the event had accually fired... and nothing...

Totally confused...

Tim
 
Sorry, this is probably my bad. Add the handler to the end, so :-

VB.NET:
Private Sub Form1_Resize(ByVal sender As Object, ByVal e As EventArgs)

should be

VB.NET:
Private Sub Form1_Resize(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Resize
 
Back
Top