Simple C# "new" question - syntax related -


I'm just curious how to create a new object in the command (to save space and to learn it at all) To combine commands together and on the additional line, the picture box is not ABC = new image box, like this: this.Form.Controls.Add (new Picturebox ABC) // something like that?

Thanks for the help

You have to instantize the object and Another object that must pass in form

For example, you will write it in the code of 2 lines

  Picturebox.TEST myPictureBox = new Picturebox.TEST (); Form.Controls.Add (myPictureBox);  

You are simply passing the object in the form of the form. Control. Add. So to do this in line 1 ...

  Form.Controls.Add (New Picturebox.TEST ());  

The first example is more readable and also gives you permission to use the myPictureBox instance in that method block.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -