Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27056

VS 2010 Copy Display from DataGridView1 to TextBox1 separating it with '; '

$
0
0
Hello.

I want to copy Display text from DataGridView1 to TextBox1 separating it with '; '




My DataGridViev1 code:
Code:

    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click

        Using WebData As New DataTable()
            WebData.Columns.AddRange(New DataColumn() _
                { _
                    New DataColumn("Display", GetType(System.String)), _
                    New DataColumn("Link", GetType(System.String)) _
                } _
            )

            WebData.TableName = "Links"

            Dim theElementCollection As HtmlElementCollection = WebBrowser1.Document.GetElementsByTagName("a")

            For Each curElement As HtmlElement In theElementCollection

                WebData.Rows.Add(New Object() {
                                IIf(curElement.InnerText = "", "(Empty)", curElement.InnerText),
                                curElement.GetAttribute("href").ToString})
            Next

            DataGridView1.DataSource = WebData

        End Using

        Using WebData As New DataTable()
            WebData.Columns.AddRange(New DataColumn() _
                { _
                    New DataColumn("Display", GetType(System.String)), _
                    New DataColumn("Link", GetType(System.String)) _
                } _
            )


            TextBox1.Text = String.Join("; ",
                (
                    From T In WebData.AsEnumerable
                    Select T.Field(Of String)("display")).ToArray
                )
        End Using



    End Sub




Thanks a lot for help.
Attached Images
 

Viewing all articles
Browse latest Browse all 27056

Trending Articles



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