private void disp_gender(Subj_Data S) { int ID = S.get_ID(); if (((TextBox)this.gender_list[ID]).InvokeRequired) { GenderBoxCallback g = new GenderBoxCallback(disp_gender); this.Invoke(g, new object[] { S }); } else { TextBox t = (TextBox)this.gender_list[ID]; //t.Text = Math.Round(S.get_age()).ToString(); char gender = S.get_gender(); if (gender == 'F') { t.BackColor = Color.Indigo; t.ForeColor = Color.White; t.Text = "FEMALE"; } else { t.BackColor = Color.DimGray; t.ForeColor = Color.White; t.Text = "MALE"; } } }
private char get_gender() { if (this.genderBox.InvokeRequired) { GenderBoxCallback c = new GenderBoxCallback(get_gender); return (char)this.Invoke(c, new object[] { }); } else { return Convert.ToChar(genderBox.SelectedItem); } }