如何将值datagrid发送到文本框的不同形式 [英] how send value datagrid to textbox different form

查看:86
本文介绍了如何将值datagrid发送到文本框的不同形式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在事件单击datagridview时,如何将支持表单中datagridview中的值发送并使用到Main Form中的maskedTextBox中,我该如何使用它?
请帮助我

How do I send and use values in datagridview at support form into maskedTextBox at Main Form in event click datagridview and what method I use for it?
Please help me

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 String
    Dim _SPP As New SSPForm
    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 & "." & b
        .m_oDescription.Text = c
    End With
    Me.Hide()
End Sub

推荐答案

像我这样,这必须是一个简单的任务
根据我对您的
的了解 需求
试试看,请让我知道您的反馈.

让我们假设Form1是您的包含以下内容的支持表格
具有相关数据的dataGridview
而Form2是包含文本框的主窗体

在Form1中表示您的支持表格中的
在dataGridView_CellContentClick下

这样编写以下代码
As Per me This Must Be a Simple Task
According to what I understand about Your
Need
Try This and Please Get Me know your Feedback.

Let us Suppose Form1 is your Support Form Containing
The dataGridview having the Related Data
And Form2 be Your main Form Containing the TextBox

Inside Form1 means in your Support Form
under dataGridView_CellContentClick
Write The Following Code like

MainformName.TextBoxName1.Text=dataGridView.SelectedCells.Item(0).Value.ToString()
MainformName.TextBoxName2.Text=dataGridView.SelectedCells.Item(1).Value.ToString()



根据需要实现此功能



Implement this As Per Your need


,您可以根据要单击的行从datagridview中找到任何值
.
例如
you can find any value from datagridview, based on which row you are clicking
.
for example
Dim invoiceIdTick As String = DataGridView1.Rows(e.RowIndex).Cells(2).Value.ToString()



在DataGridView1_CellContentClick事件上编写代码.从事件e中,您可以找到行索引及其所有列值.

我认为这会对您有所帮助.



write your code on DataGridView1_CellContentClick event. From event e you can find the row index and all its column value.

I think this will help you.


这篇关于如何将值datagrid发送到文本框的不同形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆