is their a way to add rows to a datagrid during run time?
so when a datagrid is shown you can click on a button and that their is a row added to the datagrid so you can fill it in ?
any suggestions ???
thnx
greetings
Printable View
is their a way to add rows to a datagrid during run time?
so when a datagrid is shown you can click on a button and that their is a row added to the datagrid so you can fill it in ?
any suggestions ???
thnx
greetings
do it with the datatable
:bigyello:VB Code:
Dim cn As New SqlConnection("user id=sa;password=password;initial catalog=northwind") Dim da As New SqlDataAdapter() Dim dt As New DataTable() Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load cn.Open() da.SelectCommand = New SqlCommand("select * from territories", cn) da.Fill(dt) DataGrid1.DataSource = dt End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim r As DataRow = dt.NewRow dt.Rows.Add(r) End Sub