I would like to do something like this: comboBox6.Items.AddRange(new IEnumerable<int> { Enumerable.Range(1,8).ToArray() } ); (add numbers 1 to 8 to ComboBox Items using an IEnumerable object), but i can't figure out how. Thanks.

Member Avatar
Member Avatar
+0 forum 2

Hello, I'm having an issue with updating a couple list boxes in the form load procedure. I have an array created from a MySQL database, and when I try to add that array to more than one ListBox, I get: [code]A first chance exception of type 'System.ArgumentNullException' occurred in System.Windows.Forms.dll[/code] Here is the code: [code] Database_Functions.UpdateNames(Names) Me.lstRoster_Roster.Items.Clear() Me.lstRoster_Roster.Items.AddRange(Names) Me.lstRoster_Home.Items.Clear() Me.lstRoster_Home.Items.AddRange(Names) [/code] And Database_Functions.UpdateNames: [code] Public Sub UpdateNames(ByRef Names() As String) Dim sql As String = "SELECT Name FROM users" Dim cmd As MySqlCommand = New MySqlCommand(sql, Login.SQLConnection) Dim reader As MySqlDataReader = cmd.ExecuteReader() Do While reader.Read() Static i As Integer …

Member Avatar
Member Avatar
+0 forum 1

I am trying to populate an ArrayList using the elements from a DataTable. I know I could do this using Loop, but I am trying to figure out how to using AddRange. Here's my code: [CODE]SomeArrayList.AddRange(SomeDataTable.Rows.Item(0).ItemArray)[/CODE] The problem is that I can pass the collection except for the Zeroth element. This is the collection I am trying to pass to the ArrayList: 1. Dog 2. Cat 3. Bird This is what I got 1. Cat 2. Bird

Member Avatar
Member Avatar
+0 forum 3

The End.