/// <summary> /// Store values in local atribbutes and update DataGridView. /// </summary> private void RefreshUserList() { // Retrieve all users from .json File users = sendRequest.RequestUsers(); // Set Name from users in ComboBox foreach (Users user in users) { comboBoxUsersList.Items.Add(user.Name); } // Set 0 as default ComboBox selected value. comboBoxUsersList.SelectedIndex = 0; // Store current combobox index currentComboBoxIndex = comboBoxUsersList.SelectedIndex; // Send current combobox index and sum one to fill DataGridView with selected user ID. RefreshDataGrid(currentComboBoxIndex + 1); }