Somehow I'm not really getting how to correctly use .ItemArray()
I have a function that should return an array of strings.
The array should be populated by a) a datacolumn or b) a fixed set (in case no data in datatable)
VB Code:
Function SubExtensions() As Array 'Set the user defined Extentionlist 'When a custom list is saved it is loaded into table "Extenions" during startup (LoadSettings()) 'If the list is empty populate with hardcoded list Dim tbl As DataTable = frmMain.dsProgramSettings.Tables.Item("Extensions") Dim row As DataRow Dim item As String Dim arrList() As String = {".mpg", ".avi", ".mov", ".wmv", ".iso", ".bin", ".nrg", ".mp4", ".img", ".bup"} If tbl.Rows.Count > 0 Then Return tbl.Rows.Item("Extension").ItemArray Else 'Populate dataset table For Each item In arrList ' fill datatable row = tbl.NewRow row("Extension") = item.ToString.ToLower tbl.Rows.Add(row) Next Return arrList End If End Function
Itemarray returns an index of integers, but I want a list of strings (column "Extension"). How should I do that ?




Reply With Quote