hi, I want to spent the values of textbox to datagridview from another form and that after a click on the button add, help me please

You'll have to explain that a bit better. I don't understand what you are asking.

Public Class Form4
    Dim dt As New DataTable
    Private Sub Form4_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        dt.Columns.Add("Value")
    End Sub

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

        dt.Rows.Add(Form3.TextBox1.Text)
        DataGridView1.DataSource = dt
    End Sub
End Class

Hope the above code will help u.!

thanks , but i will explain my problem..I have a form that contains a textbox and a button "Register" and in the other form there is a datagridview, I want that when I click on the "Register" button, the values of textbox will automatically appear in the datagridview I tried several solutions but it does not work, I use visual studio 2013 software with vb code, can you help me please

For the following example create a new project with two forms named form1 and form2. Form1 has a button and two textboxes with the default names. Form2 has a DataGridView with the given name.

Public Class Form1

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

        Dim row As New DataGridViewRow()

        row.Cells.AddRange({New DataGridViewTextBoxCell(), New DataGridViewTextBoxCell()})
        row.Cells(0).Value = TextBox1.Text
        row.Cells(1).Value = TextBox2.Text
        Form2.DataGridView1.Rows.Add(row)

    End Sub

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Form2.Show()
    End Sub

End Class
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.