Question:
Help with a very simple C# code.?
2008-02-27 20:04:09 UTC
I am just learning as you'll be able to tell by my question. I need to....
Create a project with a single text box. In the Resize event of the form, show the Width of the form in
the text box. I have Visual Studios 2008.
Thanks to any help in advance!!!
Three answers:
Michael J
2008-02-27 20:25:48 UTC
Bashar Y was almost there :) but it's a little different.

In C# it would be:



textbox1.Text = this.Width.ToString();



or Height of course, like he said.

Make sure you don't forget ToString() behind it,

C# is a little stricter than VB ;)
2016-10-23 01:56:53 UTC
//be certain the calculations if (status = a million) { ^^ accurate right here's a minimum of one challenge. Your at the prompt are not operating a evaluation of status and a million, you're *putting* status = a million which will *consistently* be certain as actual through very reality this kit effectively assigned a million to status. you want (status == a million). once you employ this, imagine of to your self "is equivalent" fairly than "equals". It helps. :) it somewhat is failing pondering you're putting an surprising decision accurate right into a string and then employing it like a integer. replace your status to and integer and bypass decrease decrease back. also, you ignored the 'const' on your constants. Oh, I see; became it through very reality it complained that you've been comparing constants with non-constants? Yeah, it really is a soreness.. Cheers!
Bashar Y
2008-02-27 20:10:38 UTC
pkey i have visual basic but i can help you in visual basic i use this "

textbox1.text =me.width



you can use heigh too..


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Continue reading on narkive:
Loading...