用ComboBox控件来编辑C#中ListView控件中数据,提示这个错误怎么解决??
就是按照网上流传的这个方法,但是每次都提示
错误 1 “WindowsControlLibrary4.UserControl1.Dispose(bool)”: 没有找到适合的方法来重写 E:\工作\ERP\牡丹考核\ListView中Combobox实验\WindowsControlLibrary4\WindowsControlLibrary4\UserControl1.Designer.cs 14 33 WindowsControlLibrary4
不知道这个该怎么改,还望多多指教!!!
*****************************************************************************************
创建继承 ListView 控件
1. 启动 MicrosoftVisualStudio.NET 或 Microsoft Visual Studio 2005。
2. 在文件菜单, 指向新建 , 然后单击项目 。
3. 在新建项目 对话框中, 单击 ProjectTypes@@ , 下VisualC #项目,然后单击模板下WindowsControlLibrary@@ 。
注意 对于 Visual Studio 2005, 单击 项目类型 下 VisualC # 。
4. 用以下代码替换所有 UserControl 类中代码:
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
namespace InheritedListView{
/// <summary>
/// Summary description for UserControl1.
/// </summary>
public class MyListView : System.Windows.Forms.ListView
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public MyListView()
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
// TODO: Add any initialization after the InitForm 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 Component 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()
{
components = new System.ComponentModel.Container();
}
#endregion
private const int WM_HSCROLL = 0x114;
private const int WM_VSCROLL = 0x115;
protected override void WndProc(ref Message msg)
{
// Look for the WM_VSCROLL or the WM_HSCROLL messages.
if ((msg.Msg == WM_VSCROLL) || (msg.Msg == WM_HSCROLL))
{
// Move focus to the ListView to cause ComboBox to lose focus.
this.Focus();
}
// Pass message to default handler.
base.WndProc(ref msg);
}
}
}
***********************************************************
UserControl1.Designer.cs 中的代码是这样的。。
namespace WindowsControlLibrary4
{
partial class UserControl1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
}
#endregion
}
}