private void comboBoxRequestedCarType_SelectedIndexChanged(object sender, EventArgs e) { try { CoreWebService.CarTypeAttributeListResponse carTypeatrributes = client.listCarTypeAttributes((int)comboBoxRequestedCarType.SelectedValue); if (carTypeatrributes.Status == 0) { listBoxCarTypeAttributes.DisplayMember = "attribute"; listBoxCarTypeAttributes.ValueMember = "ID"; listBoxCarTypeAttributes.DataSource = carTypeatrributes.Data; listBoxCarTypeAttributes.ClearSelected(); } CoreWebService.BillOfLadingCarTypeAttributesListResponse rollingStockAttribute = client.listBillOfLadingCartypeAttribute((int)listBoxBillOfLading.SelectedValue); for (int i = 0; i < rollingStockAttribute.Data.Length; i++) { listBoxCarTypeAttributes.SelectedValue = rollingStockAttribute.Data[i].carTypeAttributeID; int r = listBoxCarTypeAttributes.SelectedIndex; listBoxCarTypeAttributes.SetSelected(r, true); } } catch (NullReferenceException) { } }
private void refreshAttributeListBox() { try { CoreWebService.CarTypeAttributeListResponse response = client.listCarTypeAttributes(Convert.ToInt32(listBoxCarType.SelectedValue)); if (response.Status == 0) { listBoxAttributes.DataSource = response.Data; listBoxAttributes.DisplayMember = "attribute"; listBoxAttributes.ValueMember = "ID"; } else { } } catch (InvalidCastException e) { } }
private void comboBoxCarType_SelectedIndexChanged(object sender, EventArgs e) { CoreWebService.CarTypeAttributeListResponse carTypeAttributes = client.listCarTypeAttributes((int)comboBoxCarType.SelectedValue); listBoxCarTypeAttributes.DisplayMember = "attribute"; listBoxCarTypeAttributes.ValueMember = "ID"; listBoxCarTypeAttributes.DataSource = carTypeAttributes.Data; listBoxCarTypeAttributes.ClearSelected(); try { CoreWebService.RollingStockAttributeListResponse rollingStockAttribute = client.listRollingStockAttribute((int)listBoxCars.SelectedValue); for (int i = 0; i < rollingStockAttribute.Data.Count; i++) { listBoxCarTypeAttributes.SelectedValue = rollingStockAttribute.Data[i].carTypeAttrID; int r = listBoxCarTypeAttributes.SelectedIndex; listBoxCarTypeAttributes.SetSelected(r, true); } } catch (NullReferenceException) { } }