16-05-22 12:52 PM
Answered! Go to Answer.
16-05-22 01:36 PM
Dim columnCount As Integer = Input_Collection_Two.Columns.Count
Dim additionalRowCount As Integer = Math.Abs(Input_Collection_One.Rows.Count - Input_Collection_Two.Rows.Count)
If Column_Position > columnCount Then
Throw New Exception("The column position provided is out of range")
End If
If (additionalRowCount > 0 And Input_Collection_One.Rows.Count > Input_Collection_Two.Rows.Count) Then
For i As Integer = 1 To additionalRowCount
Dim newRow As DataRow = Input_Collection_Two.NewRow
Input_Collection_Two.Rows.Add(newRow)
Next
End If
Input_Collection_Two.Columns.Add(Column_Name)
Input_Collection_Two.Columns(Column_Name).SetOrdinal(Column_Position)
Dim rowCounter As Integer = 0
For Each dr As DataRow In Input_Collection_One.Rows()
Input_Collection_Two.Rows(rowCounter).Item(Column_Name) = Input_Collection_One.Rows(rowCounter).Item(Column_Name)
rowCounter += 1
Next
Output_Collection = Input_Collection_Two
16-05-22 01:36 PM
Dim columnCount As Integer = Input_Collection_Two.Columns.Count
Dim additionalRowCount As Integer = Math.Abs(Input_Collection_One.Rows.Count - Input_Collection_Two.Rows.Count)
If Column_Position > columnCount Then
Throw New Exception("The column position provided is out of range")
End If
If (additionalRowCount > 0 And Input_Collection_One.Rows.Count > Input_Collection_Two.Rows.Count) Then
For i As Integer = 1 To additionalRowCount
Dim newRow As DataRow = Input_Collection_Two.NewRow
Input_Collection_Two.Rows.Add(newRow)
Next
End If
Input_Collection_Two.Columns.Add(Column_Name)
Input_Collection_Two.Columns(Column_Name).SetOrdinal(Column_Position)
Dim rowCounter As Integer = 0
For Each dr As DataRow In Input_Collection_One.Rows()
Input_Collection_Two.Rows(rowCounter).Item(Column_Name) = Input_Collection_One.Rows(rowCounter).Item(Column_Name)
rowCounter += 1
Next
Output_Collection = Input_Collection_Two
16-05-22 03:08 PM
16-05-22 03:59 PM