Click here to Skip to main content
13,733,962 members
Rate this:
Please Sign up or sign in to vote.
See more:
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
    Dim i As Integer
    Dim a, b, c As New Object
    a = Me.DataGridView1(0, i).Value.ToString
    b = Me.DataGridView1(1, i).Value.ToString
    c = Me.DataGridView1(2, i).Value.ToString
    i = DataGridView1.CurrentRow.Index
    With _SPP
        .m_oMAP.Text = a.ToString & "." & b.ToString
        .m_oDescription.Text = c.ToString
    End With
End Sub

I want send value in datagridview into textbox different form but I don't know ... can you help me for give me a solution ??? true or false this source
Posted 5-May-11 22:25pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Create a string property in your second form, that will hold the textbox contents. Then in your Main form you need to hold a reference to the second form. Then when your DataGridView cell changes you can update the string property you created, and bind the textbox to that string:

something like this

Public Class Form1
    Private myForm2 As Form2
    Private Sub DataGridView1_CellLeave(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellLeave
        myForm2.textBoxResult = DataGridView1.CurrentCell.Value
    End Sub
End Class

Public Class Form2
    Public textBoxResult As String
End Class

Hope this helps
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

string stSQL = "SELECT * FROM [Tablename];

			conn = <sqlconnection>
			SqlCommand cmd = new SqlCommand(stSQL, conn);
			SqlDataReader myReader;
			myReader = cmd.ExecuteReader();

                       textboxid.text=myReadaer["Column Name"].ToString();


I think surely it is helpful to you

Happy Codding....:)


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web01-2016 | 2.8.180920.1 | Last Updated 6 May 2011
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100