gridview的差异清除功能

发布于 2024-12-02 00:09:55 字数 596 浏览 3 评论 0原文

出现了 如何清除 GridView 中的数据?

     GridView1.DataSource = null;
     GridView1.DataBind();

我想知道

     GridView1.Clear();

GridView的两个函数 的区别GridView1.Clear() 和 GridView1.DataSource = null。我没有清除 GridView1.Clear() 语法的错误。

Public Sub Clear()
    Data.Dispose()
    Data = New DataSet
    MyBase.DataSource = Nothing
End Sub

我写了一个新的gridview类继承System.Windows.Forms.DataGridView.Vb类,在它的类中调用了我的clear函数。抱歉,gridview.Clear()没有。

How can I clear data in a GridView? is appeared

     GridView1.DataSource = null;
     GridView1.DataBind();

I want to Know difference of

     GridView1.Clear();

two function of GridView1.Clear() and GridView1.DataSource = null.I have no error which clear of syntax of GridView1.Clear().

Public Sub Clear()
    Data.Dispose()
    Data = New DataSet
    MyBase.DataSource = Nothing
End Sub

I wrote new class of gridview Inherits System.Windows.Forms.DataGridView.Vb class called my clear function in its class.Sorry,gridview.Clear() is not have.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

不甘平庸 2024-12-09 00:09:55

我没有看到 GridView 方法

如果您想清除 GridView 中的当前行,上面链接的答案就是执行此操作的方法:

'VB.NET
GridView1.DataSource = Nothing
GridView1.DataBind()

//C#
GridView1.DataSource = null;
GridView1.DataBind();

如果上述方法不适合您,请使用代码更新您的问题以及您遇到的错误(如果有)正在看到。

I don't see any Clear() method listed for GridView Methods.

If you want to clear the current rows in a GridView, the answer you linked to above is the way to do it:

'VB.NET
GridView1.DataSource = Nothing
GridView1.DataBind()

//C#
GridView1.DataSource = null;
GridView1.DataBind();

If the above isn't working for you, please update your question with the code and what error, if any, you're seeing.

错爱 2024-12-09 00:09:55

如果你想删除gridview的行
你可以使用这个:
Gridview1.Rows.Clear();

If you want to delete the rows of a gridview
you can use this:
Gridview1.Rows.Clear();

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文