标题:VB.NET的datagridview的用法,求助高手!
只看楼主
vbhyx2008
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2007-12-24
 问题点数:0 回复次数:0 
VB.NET的datagridview的用法,求助高手!
我刚刚学,我做了一个FORM,里面有一个按钮,还有一个DATAGRIDVIEW控件, 然后,按钮中的代码如下:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim strCon As String = "Server=127.0.0.1;Initial Catalog=jmgl;Persist Security Info=True;User ID=sa;Password=hua1234; "
        'Dim strcon As New SqlClient.SqlConnection("data source=(127.0.0.1);initial catalog=TEST;user id=sa;pwd=")

        Dim conn As SqlConnection
        conn = New SqlConnection(strCon)
        Dim str_cmd As String = "select id,idate,itemid,itemtype,unit,boxid,color from jm_item order by itemid"
        Dim da As New SqlClient.SqlDataAdapter
        da.SelectCommand = New SqlClient.SqlCommand(str_cmd, conn)
        Dim mydataset As New DataSet
        da.Fill(mydataset)
        DataGridView1.DataSource = mydataset.Tables(0)
        DataGridView1.Enabled = True
        conn.Close()
        conn.Dispose()

END SUB

现在,点击查找按钮时,则数据可以在DATAGRIDVIEW控件中显示出来记录, 现在我想在FORM上添加一个"修改"按钮, 那么,请问我如何可以对DATAGRIDVIEW中的值修改后,点那个"修改"按钮,则提示保存OK呢? 我刚刚学,不知如何在修改按钮中写代码,麻烦高手指教一下,谢谢(注:我的DATAGRIDVIEW 是通过查找出来的记录临时绑定的).
等待高人指点!
搜索更多相关主题的帖子: NET datagridview 用法 Dim 
2007-12-24 14:14



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-194046-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.091960 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved