w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
VB.NET Populate textbox with Datagrid first column when datagrid checkbox is selected

Something like (easier to understand):

Dim result as String = ""
For x As Integer = 0 to DataGridView1.Rows.Count - 1
  If DataGridView1.Rows(x).Cells("Select_Column").Value Then
     result &= DataGridView1.Rows(x).Cells("LossTypes").Value & ","
  End If
if result.length > 0 then 
   Textbox1.Text = Microsoft.VisualBasic.Left(result, result.length-1)
   Textbox1.Text = ""

or using Linq

Textbox1.Text = Join((From C DataGridView1.Rows Where
C.Cells("Select_Column").Value Select C.Cells("LossTypes").Value).ToArray,

© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.