cboitem.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace FPER
  5. {
  6. /** <!--Combobox에 item 넣기 사용예-->
  7. * cboUse_Flag.Items.Clear();
  8. * ArrayList ary = new ArrayList();
  9. * ary.Add(new cboitem("Y", "사용함"));
  10. * ary.Add(new cboitem("N", "사용안함"));
  11. *
  12. * cboUse_Flag.DataSource = ary;
  13. * cboUse_Flag.DisplayMember = "text";
  14. * cboUse_Flag.ValueMember = "value";
  15. *
  16. *
  17. * <!--Combobox에 item value 읽어오기 사용예-->
  18. * CType(cboYear.SelectedItem, cmbValue).ToString();
  19. *
  20. *
  21. ***/
  22. public class cboitem
  23. {
  24. private object cboValue = null;
  25. private object cboText = null;
  26. public cboitem(object val, object txt)
  27. {
  28. //base();
  29. this.cboValue = val;
  30. this.cboText = txt;
  31. }
  32. public object ValueObject
  33. {
  34. get
  35. {
  36. return this.cboValue;
  37. }
  38. }
  39. public String value
  40. {
  41. get
  42. {
  43. return this.cboValue.ToString();
  44. }
  45. }
  46. public String text
  47. {
  48. get
  49. {
  50. return this.cboText.ToString();
  51. }
  52. }
  53. public override string ToString()
  54. {
  55. if (this.cboValue == null) return "";
  56. else return this.cboValue.ToString();
  57. //return "";
  58. }
  59. }
  60. }