public static void FillStarSign(ComboBox cmb) { StarSignViewModel viewModel = new StarSignViewModel(); cmb.DisplayMember = "StarSignName"; cmb.ValueMember = "StarSignId"; var entities = viewModel.GetAllStarSigns().ToList(); StarSignDto dto = new StarSignDto() { Code = 0, StarSignId = 0, StarSignName = "തിരഞ്ഞെടുക്കുക" }; entities.Add(dto); cmb.DataSource = entities; cmb.SelectedValue = 0; }
private void txt_StarSign_Leave(object sender, EventArgs e) { if (Common.ValidateIntOnly((TextBox)sender)) { int code = Convert.ToInt32(txt_StarSign.Text); StarSignViewModel viewModel = new StarSignViewModel(); var starSign = viewModel.GetByCode(code); if (starSign != null) { cmb_Star.SelectedValue = starSign.StarSignId; } else { MessageBox.Show("കോഡ് തെറ്റാണ് "); txt_StarSign.Text = string.Empty; txt_StarSign.Focus(); } } }