开发者

Gridview Data Update by ComboBox

Hi Friends i Want code for

I have a gridvie Fill with dataset. But i want If i edit the data in gridview it reflect in corresponding combobox a开发者_JAVA百科nd update in db.

Pl anyone help me


you can bind the data on datagridview and combobox having the same datasource. so that every edits on datagridview will also reflect on the combobox. then after that you can call a command to save it on the database.

 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim table As New DataTable
        Dim row As DataRow
        table.Columns.Add(New DataColumn("name", System.Type.GetType("System.String")))
        For i As Integer = 1 To 30
            row = table.NewRow
            row("name") = "name" & i
            table.Rows.Add(row)
        Next
        DataGrid1.DataSource = table
        ComboBox1.DataSource = table
        ComboBox1.DisplayMember = "name"
    End Sub

Private sub DoEvents()
  '// Do anything here
End Sub
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜