Click here to Skip to main content
15,891,136 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: import from excel Pin
Paladin20004-Oct-11 8:07
Paladin20004-Oct-11 8:07 
AnswerRe: import from excel Pin
Dalek Dave6-Oct-11 22:31
professionalDalek Dave6-Oct-11 22:31 
Question[solved] sorting a subset of a datatable in a different order Pin
Armigo4-Oct-11 2:16
Armigo4-Oct-11 2:16 
AnswerRe: sorting a subset of a datatable in a different order Pin
Dave Kreskowiak4-Oct-11 3:30
mveDave Kreskowiak4-Oct-11 3:30 
QuestionRe: sorting a subset of a datatable in a different order Pin
Armigo4-Oct-11 22:52
Armigo4-Oct-11 22:52 
AnswerRe: sorting a subset of a datatable in a different order Pin
Simon_Whale4-Oct-11 23:36
Simon_Whale4-Oct-11 23:36 
AnswerRe: sorting a subset of a datatable in a different order Pin
Dave Kreskowiak5-Oct-11 4:46
mveDave Kreskowiak5-Oct-11 4:46 
GeneralRe: sorting a subset of a datatable in a different order Pin
Armigo10-Oct-11 2:30
Armigo10-Oct-11 2:30 
Hello everybody and thanks for your replies,

i could manage to solve the problem with the algorithm presented in my first post. Here is my solution for those, who are interested in it:

VB
iBlockRowStart = iCurrentRow
iBlockRowStop = iBlockRowStart

' Step 1: The first row of the block is recognized through a previous if-inquiry. Now get the last row with the appropiate condition - in this case the block ends until the day of week in the current row isn't friday
' DS is my DataSet, which is already filled with data 

Do While System.Convert.ToDateTime(DS.Tables("AnyTable").Rows(iBlockRowStop).Item("Date")).DayOfWeek = dayofweek.Friday
	iBlockRowStop = iBlockRowStop + 1
	If iBlockRowStop = DS.Tables("AnyTable").Rows.Count Then
		Exit Do
	End If
Loop
iBlockRowStop = iBlockRowStop - 1
						
' Step 2: Clone tablestructure and then copy block-rows to a new, temporary datatable
tempTable = DS.Tables("AnyTable").Clone()
For j = iBlockRowStart To iBlockRowStop
	tempTable.ImportRow(DS.Tables("AnyTable").Rows(j))
Next
						
' Step 3, 4 & 5: Assign Data to DataView, Sort Data and reassign to new DataTable
View = tempTable.DefaultView
View.Sort = "ColA, ColB"
Dim tempTable2 as DataTable = View.ToTable()
						
' Step 6: Copy datarows of tempTable2 into the section of the table in my DataSet, specified by my indices
For j = iBlockRowStart To iBlockRowStop
	For k = 0 To tempTable2.Columns.Count - 1
		DS.Tables("AnyTable").Rows(j).Item(k) = tempTable2.Rows(j - iBlockRowStart).Item(k)
	Next
Next


With this piece of code it is possible to sort a part of a datatable in a dataset in another order. In my case, i needed this repeatedly when the date of my record was friday. I needed to sort my "friday-records" in another order. My datatable was filled with data of a month, so i had four fridays...

Thanks again for your help!
AnswerRe: sorting a subset of a datatable in a different order Pin
Luc Pattyn4-Oct-11 4:08
sitebuilderLuc Pattyn4-Oct-11 4:08 
Questionadding a reference System.Web.UI Pin
Minenhle Ndlovu3-Oct-11 3:20
Minenhle Ndlovu3-Oct-11 3:20 
AnswerRe: adding a reference System.Web.UI Pin
Dave Kreskowiak3-Oct-11 3:39
mveDave Kreskowiak3-Oct-11 3:39 
AnswerRe: adding a reference System.Web.UI Pin
Luc Pattyn3-Oct-11 4:27
sitebuilderLuc Pattyn3-Oct-11 4:27 
AnswerRe: adding a reference System.Web.UI Pin
Simon_Whale3-Oct-11 4:46
Simon_Whale3-Oct-11 4:46 
AnswerRe: adding a reference System.Web.UI Pin
Eddy Vluggen3-Oct-11 8:30
professionalEddy Vluggen3-Oct-11 8:30 
QuestionHow to print multiple reportviewer report on a single button? Pin
C#Coudou2-Oct-11 13:46
C#Coudou2-Oct-11 13:46 
QuestionHow to create my own spammer with VBscript Pin
Shubhamraj1-Oct-11 20:01
Shubhamraj1-Oct-11 20:01 
AnswerRe: How to create my own spammer with VBscript Pin
Richard MacCutchan1-Oct-11 21:29
mveRichard MacCutchan1-Oct-11 21:29 
AnswerRe: How to create my own spammer with VBscript Pin
Dalek Dave1-Oct-11 22:44
professionalDalek Dave1-Oct-11 22:44 
GeneralRe: How to create my own spammer with VBscript Pin
Sander Rossel2-Oct-11 0:16
professionalSander Rossel2-Oct-11 0:16 
GeneralRe: How to create my own spammer with VBscript Pin
Richard MacCutchan2-Oct-11 1:49
mveRichard MacCutchan2-Oct-11 1:49 
AnswerRe: How to create my own spammer with VBscript Pin
Dave Kreskowiak2-Oct-11 1:57
mveDave Kreskowiak2-Oct-11 1:57 
AnswerRe: How to create my own spammer with VBscript Pin
Bert Mitton3-Oct-11 3:10
professionalBert Mitton3-Oct-11 3:10 
QuestionPlaying with services Pin
DeDelva30-Sep-11 2:15
DeDelva30-Sep-11 2:15 
AnswerRe: Playing with services Pin
Dave Kreskowiak30-Sep-11 3:36
mveDave Kreskowiak30-Sep-11 3:36 
QuestionRe: Playing with services Pin
DeDelva2-Oct-11 2:12
DeDelva2-Oct-11 2:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.