Public Function SwapTable(ByRef dt As DataTable, ByVal col As Integer) As DataTable
Try
Dim dtTemp As New DataTable
Dim inti, intj As Integer
dtTemp.Columns.Clear()
dtTemp.Columns.Add(dt.Columns(col).Caption)
For inti = 0 To dt.Columns.Count - 1
If inti = col And inti  0 Then
'If dt.Columns(0).Caption.Trim  "DC_NOHID" Then
dtTemp.Columns.Add(dt.Columns(0).Caption)
'Else
' dtTemp.Columns.Add(dt.Columns(1).Caption)
'End If
End If
If inti  col And inti  0 Then
dtTemp.Columns.Add(dt.Columns(inti).Caption)
End If
Next
Dim Dr As DataRow
For intj = 0 To dt.Rows.Count - 1
Dr = dtTemp.NewRow
Dr.Item(0) = dt.Rows(intj).ItemArray(col)
Dr.Item(col) = dt.Rows(intj).ItemArray(0)
inti = 1
While inti < dt.Columns.Count
If inti  0 And inti  col Then
Dr.Item(inti) = dt.Rows(intj).ItemArray(inti)
End If
inti += 1
End While
dtTemp.Rows.Add(Dr)
Next
dt.Clear()
dt = dtTemp.Copy
For inti = 0 To dt.Columns.Count - 1
dt.Columns(inti).ReadOnly = True
dt.DefaultView.Sort = dt.Columns(0).ColumnName
Next
Return dt
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Critical, "Msg")
End Try
End Function

Like it on Facebook, Tweet it or share this article on other bookmarking websites.

Comments (0)

There are no comments posted here yet

You are a short-tempered person and your wife is very calm.She never gets angry.One day, you are shouting at your wife ( as usual ) and suddenly your wife beats you.What will be your reaction?

No answer selected. Please try again.
Please select either existing option or enter your own, however not both.
Please select minimum 0 answer(s) and maximum 3 answer(s).
/polls/funny-polls/2050-you-are-a-short-tempered-person-and-your-wife-is-very-calmshe-never-gets-angryone-day-you-are-shouting-at-your-wife--as-usual--and-suddenly-your-wife-beats-youwhat-will-be-your-reaction.json?task=poll.vote
2050
radio
[{"id":"6581","title":"I will also beat her more powerfully and more number of times than she beat me.","votes":"21","type":"x","order":"0","pct":22.11,"resources":[]},{"id":"6582","title":"I will silently leave the place and think what i have said badly that made her beat me.","votes":"66","type":"x","order":"0","pct":69.47,"resources":[]},{"id":"6583","title":"I will push her out of the house and lock the door.","votes":"8","type":"x","order":"0","pct":8.42,"resources":[]}] ["#ff5b00","#4ac0f2","#b80028","#eef66c","#60bb22","#b96a9a","#62c2cc"] ["rgba(255,91,0,0.7)","rgba(74,192,242,0.7)","rgba(184,0,40,0.7)","rgba(238,246,108,0.7)","rgba(96,187,34,0.7)","rgba(185,106,154,0.7)","rgba(98,194,204,0.7)"] 350
bottom 200
No married couple wants to end up getting divorced. It is not like they have planned for it. They try to put up with their partners for as long as they
Due to our modern lifestyle, we feel that digestion related disorders are a common problem. Thus, we neither give importance to them nor seek any help
The bond of marriage brings the two people together. Initially, everything may seem okay and both of them slowly start discovering each other in the journey.
Your online reputation is important You should know that it takes decades to make your reputation but to ruin it you need just couple of minutes and this
Basics of Cookies is Asp.Net Through this article you are able to know about the following points:1> What are the cookies?2> How to write and read cookies
  Introduction A Web server hosts information in the form of HTML files. The Web server is usually passive and merely acts as an efficient interface
Best language to learn .NET language is the best thing to learn. It has somewhat similar syntax as java and it’s a Microsoft Technology moreover it
If you decide to have an  opt-in list is not just a matter of sending your subscribers your promotional newsletters or catalogs. There are several things