TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Tim Parsons
NA
10
5.4k
Very basic help
Apr 12 2011 2:59 PM
Hi
Im not a developer. Im trying to increase my understanding of the developers I work with to help us both do our jobs efficiently.
To do this I'm using the Sams Teach yourself C# in 24 hours (which so far has taken a lot longer).
An exercise in Hr 4 is eluding me.
The objective is to create a solution whereby a text box in a form populates with the new width of the form when the form is resized.
Ive created my form and text box and opened the resize event. Ive then input the following code:
namespace Form1_Event
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_SizeChanged(object sender, EventArgs e)
{
txtSize.Text = "I dont know how to do this";
}
}
}
You'll notice ive put in the text "I dont know how to do this" as my previous attempts of "txtSize.Text = Form1.Width" (and other variations of this) have produced the following error:
"An object reference is required for the non-static field, method, or property 'System.Windows.Forms.Control.Width.get'
Any ideas?
Many thanks
Tim
Reply
Answers (
11
)
print bold
TimeStamp Hours