Results 1 to 2 of 2

Thread: [RESOLVED] For loop replace item in data table

  1. #1

    Thread Starter
    Lively Member elmnas's Avatar
    Join Date
    Jul 2009
    Posts
    127

    Resolved [RESOLVED] For loop replace item in data table

    Hello people I have made a data-table that contains 20 different columns.
    I use my data-table to put the SQL Query results.

    My issue is... I need to clean/clear items from my data-table while the for loop is running.

    in this case below I want to update the data-table if the certain item column 18 does not contain "Language" replace with "0"

    here is my code:

    Code:
     If HashDatatable1.Rows.Count > 0 Then
                For i As Integer = 0 To HashDatatable1.Rows.Count - 1
    
                    If Not HashDatatable1.Rows(i).Item(18).ToString.Contains("Language:") Then
    
                    End If
    
                Next
            End If
    Could someone help me?

    Thank you in advance

  2. #2

    Thread Starter
    Lively Member elmnas's Avatar
    Join Date
    Jul 2009
    Posts
    127

    Re: For loop replace item in data table

    already solved by myself..



    Code:
            For Each dc As DataColumn In HashDatatable1.Columns
                dc.ReadOnly = False
            Next
    also

    Code:
     If HashDatatable1.Rows.Count > 0 Then
                For i As Integer = 0 To HashDatatable1.Rows.Count - 1
                    If Not HashDatatable1.Rows(i).Item(18).ToString.Contains("Language:") Then
                        HashDatatable1.Rows(i)(18) = "0"
                    End If

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width