My code is below, I feel confused that why each time I click on this code button, it adds one column as the the result on below pic.
pls kindly help. Thanks alot
VB.NET:
Private Sub btnRefresh_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRefresh.Click
'Refresh bsource and databinding
DataGridView1.DataSource = Nothing
bsource.RemoveFilter()
sqlconn.Open()
'da = New SqlDataAdapter(sql, sqlconn)
'commandBuilder = New SqlCommandBuilder(da)
ds = New DataSet()
da.Fill(ds, "New")
bsource.DataSource = ds.Tables("New")
Me.DataGridView1.DataSource = bsource
Me.DataGridView1.Columns(0).Visible = False
Dim btn As New DataGridViewButtonColumn()
DataGridView1.Columns.Add(btn)
btn.HeaderText = "Rate Update"
btn.Text = "Click Here"
btn.Name = "btn"
btn.UseColumnTextForButtonValue = True
sqlconn.Close()
End Sub
pls kindly help. Thanks alot