[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 155
  • Last Modified:

Combine rows in a DataGrid

Hi Experts

I have a Datagrid(DataGridView1) which I use to populate a Access query. I want a user to be able to select two lines and then click on a button that combines the text from both lines together.
ex:
Lines   Discription

1     Discription_1
2     Discription_2

<<AFTER COMBINE>>
Lines   Discription

1      Discription_1 & Discription_2

Thanx in advance
0
Benvor
Asked:
Benvor
1 Solution
 
jpaulinoCommented:
Hi,
You can try something like this to combine the strings:

        Dim result As String = String.Empty
        For Each cell As DataGridViewCell In Me.DataGridView1.SelectedCells
            result &= cell.Value.ToString & " & "
        Next
 
        Me.DataGridView1.SelectedCells(0).Value = result.Remove(result.Length - 2)

Open in new window

0
 
BenvorAuthor Commented:
Thanx allot
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now