Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Pass Datagridview Current Cell Value to another Form's Textbox

$
0
0
What I want is to Display the Current Cell Value of Datagridview to Another Form's Textbox.

This is my code where I want load the CellValue.
form1/frmUpdateStudent
 Private Sub frmUpdateStudent_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Me.txtID.Text = getName
    End Sub
    Public Property getName() As String
        Get
            Return names
        End Get
        Set(ByVal value As String)
            names = value
        End Set
    End Property



This is the code if I click The Datagridview and I want to pass it's value on
Form2/frmRecords.
This form is an MdiChild.When I click a button on my MdiParent Form1 will load.

 Private Sub DataGridView1_CellContentClick(sender As System.Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick

        Dim fr2 As New frmUpdateStudent
        fr2.getName = Me.DataGridView1.CurrentCell.Value.ToString
     
    End Sub




This code will display Datagridview value on Form2 Textbox but this is not what.

  Private Sub DataGridView1_CellContentClick(sender As System.Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
        Dim fr2 As New frmUpdateStudent
        fr2.getName = Me.DataGridView1.CurrentCell.Value.ToString
        fr2.Show()
    End Sub


Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>