我在代码上遇到了这个奇怪的异常:
Ongeldige vertakking van één byte op positie: 4. Aangevraagde vertakking is: 202.
现在知道nederlands并将其翻译成英文就像是:
Invalid branch of a byte at position 4. Solicited node is: 202.
现在我每次在超过4或5列的网格上选择时都会得到这个,然后选择我想要的顺序(如果是升序或降序)。现在我将展示我得到此异常的函数:
Private Sub sort()
Columns.OrderByDescending(Function(f) f.SelectedSortOrder)
Dim orderBy As String = ""
For Each col In Columns
If col.SelectedisAscending Is Nothing Then
Else
If col.SelectedisAscending.isAscending.ToUpper = "UNSORTED" Then
Else
Dim KolomNaam As String = col.Name
'orderBy = orderBy & KolomNaam
If col.SelectedisAscending.isAscending.ToUpper = "ASCENDING" Then
orderBy = KolomNaam & " ASC, " & orderBy
ElseIf col.SelectedisAscending.isAscending.ToUpper = "DESCENDING" Then
orderBy = KolomNaam & " DESC, " & orderBy
End If
End If
End If
Next
If orderBy Is Nothing Then Exit Sub
Try
If Not DataArtikelen Is Nothing Then
Dim lstData As List(Of ctArtikelen)
Dim comparer As DynamicComparer(Of ctArtikelen)
WHERE THE EXCEPTION HAAPENS--> comparer = New DynamicComparer(Of ctArtikelen)(orderBy.Substring(0, orderBy.Length - 2))
lstData = (From d In DataArtikelen).ToList
lstData.Sort(comparer)
DataArtikelen = lstData
ElseIf Not DataOrderregels Is Nothing Then
Dim lstData As List(Of ctOrdersRegels)
Dim comparer As DynamicComparer(Of ctOrdersRegels)
comparer = New DynamicComparer(Of ctOrdersRegels)(orderBy.Substring(0, orderBy.Length - 2))
lstData = (From d In DataOrderregels).ToList
lstData.Sort(comparer)
DataOrderregels = lstData
ElseIf Not DataOrders Is Nothing Then
Dim lstData As List(Of getOrdersVanPeriode_Result)
Dim comparer As DynamicComparer(Of getOrdersVanPeriode_Result)
comparer = New DynamicComparer(Of getOrdersVanPeriode_Result)(orderBy.Substring(0, orderBy.Length - 2))
lstData = (From d In DataOrders).ToList
lstData.Sort(comparer)
DataOrders = lstData
ElseIf Not DataAnnuler Is Nothing Then
Dim lstData As List(Of getAnnuleringen_Result)
Dim comparer As DynamicComparer(Of getAnnuleringen_Result)
comparer = New DynamicComparer(Of getAnnuleringen_Result)(orderBy.Substring(0, orderBy.Length - 2))
lstData = (From d In DataAnnuler).ToList
lstData.Sort(comparer)
DataAnnuler = lstData
End If
If Not DataArtikelen Is Nothing Then Data = DataArtikelen
If Not DataOrderregels Is Nothing Then Data = DataOrderregels
If Not DataOrders Is Nothing Then Data = DataOrders
If Not DataAnnuler Is Nothing Then Data = DataAnnuler
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
现在我最好的选择是字符串“orderBy”很大,因为当我选择2或3列时,我没有得到任何异常..任何人都可以给我一些帮助,并尝试解释这个例外是什么意思,如果它是可以解决它!