如何将来自多行datagrid的数据与单列添加到vb 2008中的单个文本框中 [英] how add data from multiple row of datagrid with single column to a single textbox in vb 2008

查看:79
本文介绍了如何将来自多行datagrid的数据与单列添加到vb 2008中的单个文本框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有一个数据网格和一个文本框,我希望在数据网格的行中单击鼠标时将多个值放到文本框中

i have a from with one datagrid and one textbox, i want put multiple value to textbox on mouse click in row of datagrid

推荐答案

你可以这样做这
Dim s As String = ""
For Each x As DataGridViewRow In Me.DataGridView1.Rows
    s += x.Cells(0).Value + Environment.NewLine
Next
Me.TextBox1.Text = s



请注意,TextBox1的Multiline设置为true - 如果不使用多行,则删除 + Environment.NewLine


这篇关于如何将来自多行datagrid的数据与单列添加到vb 2008中的单个文本框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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