tags:

views:

45

answers:

5

I want my form to appear at the right edge of my screen but I not use since Right is readonly .Is there a solution for this?

Right= My.Computer.Screen.WorkingArea.Right 
A: 

We won't know why until you give us more information such as an error message.

Dim nRight As Integer = My.Computer.Screen.WorkingArea.Right

works just fine.

Jim H.
Error is Right is read only
Untopronor
i am trying to set right property of form not to a vairable!
Untopronor
If you're trying to change the size or location of the form, use the `Location` property. Alternately you can use `Width` and `Height`.
Jim H.
A: 

Set the Location property instead.

John Saunders
But it might be error prone to set location i mean it might not apear proper right
Untopronor
+1  A: 

I used following and it worked

Left= My.Computer.Screen.WorkingArea.Right -Width
Untopronor
+3  A: 

Hello Untopronor

Use this code:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim x As Integer = My.Computer.Screen.WorkingArea.Right - Me.Width
    Dim y As Integer = My.Computer.Screen.WorkingArea.Bottom / 2 - Me.Height / 2
    Me.Location = New Point(x, y)
End Sub

The Y-Coordinate is not much specified in your question, so I took it as the center..! Basically you need to subtract the width of the form from the right edge, only then it will appear as you wanted.

Cheers..

Srivatsan Iyer
A: 

If you want to move the form to the right edge of the screen by stretching the form, you can use something like this:

Me.Width = Me.Width + My.Computer.Screen.WorkingArea.Right - (Me.Left + Me.Width)

If you want to move the form to the right edge of the screen without changing its width, you can use this:

Me.Left = Me.Left + My.Computer.Screen.WorkingArea.Right - (Me.Left + Me.Width)
xpda