Public Class Form1
Dim RWidth As String = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width.ToString()
Dim RHeight As String = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width.ToString()
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.Width = RWidth
Me.Height = RHeight
Death.Width = RWidth
Death.Height = RHeight
End Sub
End Class
Auto Detect screen size code makes the program a bit too big.
I figured it out you have to remove the () off System.Windows.Forms.Screen.P rimaryScreen.Bounds.Blah.ToSt ring()
First of all, why are you converting something that returns a Integer into a String then back into an Integer?
Since the window's width and height are both Integers, you don't need the ToString() part.
So basically, you are able to do it like this instead:
Dim RWidth As Integer = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width
Dim RHeight As Integer = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height
Second, for optimization you don't need to make a variable for the bounds when you can just do it directly. This is because Bounds.(Width or Height) is a function that returns a Integer.
You can also use Imports for long namespaces:
Imports System.Windows.Forms.Screen
Public Class Form1
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.Width = PrimaryScreen.Bounds.Width
Me.Height = PrimaryScreen.Bounds.Height
Death.Width = PrimaryScreen.Bounds.Width
Death.Height = PrimaryScreen.Bounds.Height
End Sub
End Class