Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

protection level

Status
Not open for further replies.

goransaler

IS-IT--Management
Mar 6, 2003
56
SE
Hello
If i try to resize with width i get
width is inaccessible due to its protection level
i cant figure out how it works
please help
 
a strange thing is that if i try at work
there is no problem
i get the fault even when i have created a new project
At work i am in a domain at home i'm in a workgroup
at both i use windows xp
 
i have heard that it can be a problem with the installation i check this at home
 
Did u try to resize the form in this own class body? Or did u call its resize method from other classes?
 
Hello

I just copy a simpel with one button

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace test
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(32, 64);
this.button1.Name = &quot;button1&quot;;
this.button1.TabIndex = 0;
this.button1.Text = &quot;button1&quot;;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 266);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.button1});
this.MaximumSize = new System.Drawing.Size(300, 300);
this.MinimumSize = new System.Drawing.Size(150, 300);
this.Name = &quot;Form1&quot;;
this.Text = &quot;Form1&quot;;
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}

private void button1_Click(object sender, System.EventArgs e)
{
width=150;
}
}
}
 
hello if i used

this.ClientSize = new System.Drawing.Size(300 , 300);

then it worked
is this a correct way to go
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top