Hello,
I just started learning this wonderful language! but I m facing some difficulties, which I would like to share, and hope for some help from you guys.
Yesterday while learning I created a program which gets the screen resolution of desktop and displays the form in top-center of screen.
I have written a code but then I get some weird error, and I dont understand it!
"An object reference is required for the nonstatic field, method, or property 'member'"
Please check my code and tell me whats wrong
- Thankyou!
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace MouseC
{
public partial class form1 : Form
{
int deskWidth = Screen.PrimaryScreen.Bounds.Width/2;
public form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
form1.Location = new Point(deskWidth, 0);
}
private void button3_Click(object sender, EventArgs e)
{
}
}
}