【发布时间】:2015-02-15 06:23:48
【问题描述】:
我得到如下错误:
找不到行的命名空间类型
这是我的代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data;
namespace DataGridView1
{
public partial class Cust_Form : Form
{
public Cust_Form()
{
InitializeComponent();
}
private void DataGridView1_Load(object sender, DataGridViewCellEventArgs e)
{
dataGridView.Rows.Add("1", "Mei", "US");
dataGridView.Rows.Add("2", "Wei", "US");
}
//private void Cust_Form_Load(object sender, EventArgs e)
//{
//}
}
}
我应该添加什么命名空间来消除此错误?我在“行”中收到错误
Cust_Form.Designer.cs
namespace DataGridView1
{
partial class Cust_Form
{
/// <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.SuspendLayout();
//
// Cust_Form
//
this.ClientSize = new System.Drawing.Size(284, 261);
this.Name = "Cust_Form";
this.Load += new System.EventHandler(this.Cust_Form_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.DataGridView dataGridView;
private System.Windows.Forms.DataGridViewTextBoxColumn Column1;
private System.Windows.Forms.DataGridViewTextBoxColumn Column2;
private System.Windows.Forms.DataGridViewTextBoxColumn Column3;
private System.Windows.Forms.DataGridViewButtonColumn Column5;
private System.Windows.Forms.DataGridViewButtonColumn Column4;
}
}
【问题讨论】:
标签: c# vb.net visual-studio-2012 datagridview