Can someone please help me with the Array.ConvertAll. I'm trying to use it so that i can convert a String array to a Integer array and then sort it with the Array.Sort command.
Below is some of the code.
I get a System.ArgumentNullException exception on line
Help would be greatly appreciated. Hope this is the right section to ask.
Below is some of the code.
VB.NET:
Public Class frmMain
Dim str As String
Dim strSorted As String
Dim splLen As Integer
Dim arrStr() As String
Dim arrInt() As Integer
Dim converter As Converter(Of String, Integer)
Private Sub btnSort_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSort.Click
str = txtList.Text
arrStr = str.Split(" ")
splLen = arrStr.GetLength(0) - 1
arrInt = Array.ConvertAll(arrStr, converter)
Array.Sort(arrInt)
For index As Integer = splLen To 0 Step -1
strSorted = strSorted & arrInt(index).ToString() & " "
Next
txtSorted.Text = strSorted
End Sub
End Class
I get a System.ArgumentNullException exception on line
VB.NET:
arrInt = Array.ConvertAll(arrStr, converter)
Help would be greatly appreciated. Hope this is the right section to ask.