textbox to datagrid

  • Thread starter Thread starter sympatico
  • Start date Start date
S

sympatico

How can we pass information from some textboxes to the datagrid with being
connected to the database at first. i want the program to get some data from
the user first. when the user press enter then the data from the textboxes
will be passed to the corresponding datagrid. The following are the sample
code. The error says "Object reference not set to an instance of an object.
"

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim s As Object

Dim r As DataGridCommandEventArgs

Dim txtName As TextBox = r.Item.Cells(1).Controls(0)

txtName.Text = TextBox1.Text

End Sub
 
What makes you thing that a button click event will pass to you a datagrid
command argument?

Eliyahu
 
Back
Top