У меня есть простая форма с некоторым текстовым полем, надписью и кнопками, проблема в том, что она выдает attempted to read or write protected memory
каждый раз, когда я изменяю размер окна, нет фоновых задач или ничего не выполняется, когда форма показывает, есть код еще не сделан, я только разработал пользовательский интерфейс, и когда я изменяю размер, появляется эта ошибка. есть идеи, почему это так? как я уже сказал, код еще не сделан, просто перетащил элементы управления и расположил их.
![enter image description here](https://i.stack.imgur.com/Zxogg.png)
это код в .Designer
namespace MyProject
{
partial class frmMain
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (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.dgvMain = new System.Windows.Forms.DataGridView();
this.btnAbout = new System.Windows.Forms.Button();
this.gbFilters = new System.Windows.Forms.GroupBox();
this.cbFiltered = new System.Windows.Forms.ComboBox();
this.cbDomain = new System.Windows.Forms.CheckBox();
this.cbUser = new System.Windows.Forms.CheckBox();
this.btnNewPsswd = new System.Windows.Forms.Button();
this.btnLogOut = new System.Windows.Forms.Button();
this.lblUsr = new System.Windows.Forms.Label();
this.txtUsr = new System.Windows.Forms.TextBox();
this.lblPassword = new System.Windows.Forms.Label();
this.txtPassword = new System.Windows.Forms.TextBox();
this.cbShow = new System.Windows.Forms.CheckBox();
this.lblDomain = new System.Windows.Forms.Label();
this.txtDomain = new System.Windows.Forms.TextBox();
this.lblUrl = new System.Windows.Forms.Label();
this.txtUrl = new System.Windows.Forms.TextBox();
this.lblNotes = new System.Windows.Forms.Label();
this.txtNotes = new System.Windows.Forms.TextBox();
this.btnDelete = new System.Windows.Forms.Button();
this.gbMain = new System.Windows.Forms.GroupBox();
this.btnEdit = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.dgvMain)).BeginInit();
this.gbFilters.SuspendLayout();
this.gbMain.SuspendLayout();
this.SuspendLayout();
//
// dgvMain
//
this.dgvMain.AllowUserToAddRows = false;
this.dgvMain.AllowUserToDeleteRows = false;
this.dgvMain.BackgroundColor = System.Drawing.Color.White;
this.dgvMain.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.dgvMain.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvMain.GridColor = System.Drawing.Color.White;
this.dgvMain.Location = new System.Drawing.Point(12, 96);
this.dgvMain.Name = "dgvMain";
this.dgvMain.ReadOnly = true;
this.dgvMain.Size = new System.Drawing.Size(544, 331);
this.dgvMain.TabIndex = 1;
//
// btnAbout
//
this.btnAbout.BackColor = System.Drawing.Color.RoyalBlue;
this.btnAbout.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnAbout.ForeColor = System.Drawing.Color.White;
this.btnAbout.Image = global::PasswordSavvy.Properties.Resources.info;
this.btnAbout.Location = new System.Drawing.Point(12, 433);
this.btnAbout.Name = "btnAbout";
this.btnAbout.Size = new System.Drawing.Size(48, 55);
this.btnAbout.TabIndex = 3;
this.btnAbout.UseVisualStyleBackColor = false;
//
// gbFilters
//
this.gbFilters.BackColor = System.Drawing.Color.Transparent;
this.gbFilters.Controls.Add(this.cbFiltered);
this.gbFilters.Controls.Add(this.cbDomain);
this.gbFilters.Controls.Add(this.cbUser);
this.gbFilters.Location = new System.Drawing.Point(12, 13);
this.gbFilters.Name = "gbFilters";
this.gbFilters.Size = new System.Drawing.Size(544, 77);
this.gbFilters.TabIndex = 3;
this.gbFilters.TabStop = false;
this.gbFilters.Text = "Filters";
//
// cbFiltered
//
this.cbFiltered.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cbFiltered.FormattingEnabled = true;
this.cbFiltered.Location = new System.Drawing.Point(243, 21);
this.cbFiltered.Name = "cbFiltered";
this.cbFiltered.Size = new System.Drawing.Size(217, 24);
this.cbFiltered.TabIndex = 2;
//
// cbDomain
//
this.cbDomain.AutoSize = true;
this.cbDomain.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cbDomain.Location = new System.Drawing.Point(106, 44);
this.cbDomain.Name = "cbDomain";
this.cbDomain.Size = new System.Drawing.Size(71, 20);
this.cbDomain.TabIndex = 1;
this.cbDomain.Text = "Domain";
this.cbDomain.UseVisualStyleBackColor = true;
//
// cbUser
//
this.cbUser.AutoSize = true;
this.cbUser.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cbUser.Location = new System.Drawing.Point(106, 18);
this.cbUser.Name = "cbUser";
this.cbUser.Size = new System.Drawing.Size(53, 20);
this.cbUser.TabIndex = 0;
this.cbUser.Text = "User";
this.cbUser.UseVisualStyleBackColor = true;
//
// btnNewPsswd
//
this.btnNewPsswd.BackColor = System.Drawing.Color.SeaGreen;
this.btnNewPsswd.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnNewPsswd.ForeColor = System.Drawing.Color.White;
this.btnNewPsswd.Location = new System.Drawing.Point(314, 433);
this.btnNewPsswd.Name = "btnNewPsswd";
this.btnNewPsswd.Size = new System.Drawing.Size(242, 55);
this.btnNewPsswd.TabIndex = 5;
this.btnNewPsswd.Text = "New Password";
this.btnNewPsswd.UseVisualStyleBackColor = false;
this.btnNewPsswd.Click += new System.EventHandler(this.btnNewPsswd_Click);
//
// btnLogOut
//
this.btnLogOut.BackColor = System.Drawing.Color.RoyalBlue;
this.btnLogOut.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnLogOut.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnLogOut.ForeColor = System.Drawing.Color.White;
this.btnLogOut.Location = new System.Drawing.Point(66, 433);
this.btnLogOut.Name = "btnLogOut";
this.btnLogOut.Size = new System.Drawing.Size(242, 55);
this.btnLogOut.TabIndex = 4;
this.btnLogOut.Text = "Log Out";
this.btnLogOut.UseVisualStyleBackColor = false;
this.btnLogOut.Click += new System.EventHandler(this.btnLogOut_Click);
//
// lblUsr
//
this.lblUsr.AutoSize = true;
this.lblUsr.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.lblUsr.Location = new System.Drawing.Point(14, 25);
this.lblUsr.Margin = new System.Windows.Forms.Padding(3, 6, 3, 3);
this.lblUsr.Name = "lblUsr";
this.lblUsr.Size = new System.Drawing.Size(37, 16);
this.lblUsr.TabIndex = 2;
this.lblUsr.Text = "User";
//
// txtUsr
//
this.txtUsr.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtUsr.Location = new System.Drawing.Point(14, 47);
this.txtUsr.Margin = new System.Windows.Forms.Padding(3, 3, 3, 6);
this.txtUsr.MaxLength = 20;
this.txtUsr.Name = "txtUsr";
this.txtUsr.ReadOnly = true;
this.txtUsr.Size = new System.Drawing.Size(297, 22);
this.txtUsr.TabIndex = 6;
//
// lblPassword
//
this.lblPassword.AutoSize = true;
this.lblPassword.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.lblPassword.Location = new System.Drawing.Point(14, 81);
this.lblPassword.Margin = new System.Windows.Forms.Padding(3, 6, 3, 3);
this.lblPassword.Name = "lblPassword";
this.lblPassword.Size = new System.Drawing.Size(68, 16);
this.lblPassword.TabIndex = 4;
this.lblPassword.Text = "Password";
//
// txtPassword
//
this.txtPassword.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtPassword.Location = new System.Drawing.Point(14, 103);
this.txtPassword.Margin = new System.Windows.Forms.Padding(3, 3, 3, 6);
this.txtPassword.MaxLength = 50;
this.txtPassword.Name = "txtPassword";
this.txtPassword.ReadOnly = true;
this.txtPassword.Size = new System.Drawing.Size(297, 22);
this.txtPassword.TabIndex = 7;
this.txtPassword.UseSystemPasswordChar = true;
//
// cbShow
//
this.cbShow.AutoSize = true;
this.cbShow.BackColor = System.Drawing.Color.Transparent;
this.cbShow.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.cbShow.ForeColor = System.Drawing.Color.Goldenrod;
this.cbShow.Location = new System.Drawing.Point(17, 134);
this.cbShow.Name = "cbShow";
this.cbShow.Size = new System.Drawing.Size(60, 20);
this.cbShow.TabIndex = 8;
this.cbShow.Text = "Show ";
this.cbShow.UseVisualStyleBackColor = false;
this.cbShow.CheckStateChanged += new System.EventHandler(this.cbShow_CheckStateChanged);
//
// lblDomain
//
this.lblDomain.AutoSize = true;
this.lblDomain.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.lblDomain.Location = new System.Drawing.Point(14, 163);
this.lblDomain.Margin = new System.Windows.Forms.Padding(3, 6, 3, 3);
this.lblDomain.Name = "lblDomain";
this.lblDomain.Size = new System.Drawing.Size(55, 16);
this.lblDomain.TabIndex = 7;
this.lblDomain.Text = "Domain";
//
// txtDomain
//
this.txtDomain.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtDomain.Location = new System.Drawing.Point(14, 185);
this.txtDomain.Margin = new System.Windows.Forms.Padding(3, 3, 3, 6);
this.txtDomain.MaxLength = 50;
this.txtDomain.Name = "txtDomain";
this.txtDomain.ReadOnly = true;
this.txtDomain.Size = new System.Drawing.Size(297, 22);
this.txtDomain.TabIndex = 9;
//
// lblUrl
//
this.lblUrl.AutoSize = true;
this.lblUrl.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.lblUrl.Location = new System.Drawing.Point(14, 219);
this.lblUrl.Margin = new System.Windows.Forms.Padding(3, 6, 3, 3);
this.lblUrl.Name = "lblUrl";
this.lblUrl.Size = new System.Drawing.Size(35, 16);
this.lblUrl.TabIndex = 9;
this.lblUrl.Text = "URL";
//
// txtUrl
//
this.txtUrl.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtUrl.Location = new System.Drawing.Point(14, 241);
this.txtUrl.Margin = new System.Windows.Forms.Padding(3, 3, 3, 6);
this.txtUrl.MaxLength = 255;
this.txtUrl.Name = "txtUrl";
this.txtUrl.ReadOnly = true;
this.txtUrl.Size = new System.Drawing.Size(297, 22);
this.txtUrl.TabIndex = 10;
//
// lblNotes
//
this.lblNotes.AutoSize = true;
this.lblNotes.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.lblNotes.Location = new System.Drawing.Point(14, 275);
this.lblNotes.Margin = new System.Windows.Forms.Padding(3, 6, 3, 3);
this.lblNotes.Name = "lblNotes";
this.lblNotes.Size = new System.Drawing.Size(44, 16);
this.lblNotes.TabIndex = 11;
this.lblNotes.Text = "Notes";
//
// txtNotes
//
this.txtNotes.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.txtNotes.Location = new System.Drawing.Point(14, 297);
this.txtNotes.Margin = new System.Windows.Forms.Padding(3, 3, 3, 6);
this.txtNotes.MaxLength = 255;
this.txtNotes.Multiline = true;
this.txtNotes.Name = "txtNotes";
this.txtNotes.ReadOnly = true;
this.txtNotes.Size = new System.Drawing.Size(297, 126);
this.txtNotes.TabIndex = 11;
//
// btnDelete
//
this.btnDelete.BackColor = System.Drawing.Color.Firebrick;
this.btnDelete.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnDelete.ForeColor = System.Drawing.Color.White;
this.btnDelete.Location = new System.Drawing.Point(202, 432);
this.btnDelete.Name = "btnDelete";
this.btnDelete.Size = new System.Drawing.Size(119, 36);
this.btnDelete.TabIndex = 13;
this.btnDelete.Text = "Delete";
this.btnDelete.UseVisualStyleBackColor = false;
//
// gbMain
//
this.gbMain.BackColor = System.Drawing.Color.Transparent;
this.gbMain.Controls.Add(this.btnEdit);
this.gbMain.Controls.Add(this.btnDelete);
this.gbMain.Controls.Add(this.txtNotes);
this.gbMain.Controls.Add(this.lblNotes);
this.gbMain.Controls.Add(this.txtUrl);
this.gbMain.Controls.Add(this.lblUrl);
this.gbMain.Controls.Add(this.txtDomain);
this.gbMain.Controls.Add(this.lblDomain);
this.gbMain.Controls.Add(this.cbShow);
this.gbMain.Controls.Add(this.txtPassword);
this.gbMain.Controls.Add(this.lblPassword);
this.gbMain.Controls.Add(this.txtUsr);
this.gbMain.Controls.Add(this.lblUsr);
this.gbMain.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.gbMain.Location = new System.Drawing.Point(563, 13);
this.gbMain.Margin = new System.Windows.Forms.Padding(4);
this.gbMain.Name = "gbMain";
this.gbMain.Padding = new System.Windows.Forms.Padding(4);
this.gbMain.Size = new System.Drawing.Size(328, 475);
this.gbMain.TabIndex = 0;
this.gbMain.TabStop = false;
this.gbMain.Text = "groupBox1";
//
// btnEdit
//
this.btnEdit.BackColor = System.Drawing.Color.RoyalBlue;
this.btnEdit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnEdit.ForeColor = System.Drawing.Color.White;
this.btnEdit.Location = new System.Drawing.Point(77, 432);
this.btnEdit.Name = "btnEdit";
this.btnEdit.Size = new System.Drawing.Size(119, 36);
this.btnEdit.TabIndex = 12;
this.btnEdit.Text = "Edit";
this.btnEdit.UseVisualStyleBackColor = false;
//
// frmMain
//
this.AcceptButton = this.btnNewPsswd;
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnLogOut;
this.ClientSize = new System.Drawing.Size(904, 497);
this.Controls.Add(this.btnLogOut);
this.Controls.Add(this.btnNewPsswd);
this.Controls.Add(this.gbFilters);
this.Controls.Add(this.btnAbout);
this.Controls.Add(this.dgvMain);
this.Controls.Add(this.gbMain);
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Margin = new System.Windows.Forms.Padding(4);
this.Name = "frmMain";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Password Savvy";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.frmMain_FormClosed);
this.Load += new System.EventHandler(this.frmMain_Load);
((System.ComponentModel.ISupportInitialize)(this.dgvMain)).EndInit();
this.gbFilters.ResumeLayout(false);
this.gbFilters.PerformLayout();
this.gbMain.ResumeLayout(false);
this.gbMain.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.DataGridView dgvMain;
private System.Windows.Forms.Button btnAbout;
private System.Windows.Forms.GroupBox gbFilters;
private System.Windows.Forms.Button btnNewPsswd;
private System.Windows.Forms.Button btnLogOut;
private System.Windows.Forms.CheckBox cbUser;
private System.Windows.Forms.ComboBox cbFiltered;
private System.Windows.Forms.CheckBox cbDomain;
private System.Windows.Forms.Label lblUsr;
private System.Windows.Forms.TextBox txtUsr;
private System.Windows.Forms.Label lblPassword;
private System.Windows.Forms.TextBox txtPassword;
private System.Windows.Forms.CheckBox cbShow;
private System.Windows.Forms.Label lblDomain;
private System.Windows.Forms.TextBox txtDomain;
private System.Windows.Forms.Label lblUrl;
private System.Windows.Forms.TextBox txtUrl;
private System.Windows.Forms.Label lblNotes;
private System.Windows.Forms.TextBox txtNotes;
private System.Windows.Forms.Button btnDelete;
private System.Windows.Forms.GroupBox gbMain;
private System.Windows.Forms.Button btnEdit;
}
}
все элементы управления в форме - перетаскивание