Skip to main content

 How would one rewrite the Enum.GetNames(typeof(MyEnumType)) syntax to .net cobol.  I am trying to populate my combobox with an enum and I cannot figure out the syntax for the GetNames().

  1. public enum MyEnumType
  2. {
  3. Sunday=0,
  4. Monday=1,
  5. Tuesday=2,
  6. Wednesday=3,
  7. Thursday=4,
  8. Friday=5,
  9. Saturday=6,
  10. }
  11.  
  12. // In the form Load event, bind the combobox to the data source.
  13. private void Form1_Load(object sender, EventArgs e)
  14. {
  15.  
  16.  
  17. comboBox2.DataSource = Enum.GetValues(typeof(MyEnumType));
  18. comboBox2.SelectedItem = MyEnumType.Friday;

 How would one rewrite the Enum.GetNames(typeof(MyEnumType)) syntax to .net cobol.  I am trying to populate my combobox with an enum and I cannot figure out the syntax for the GetNames().

  1. public enum MyEnumType
  2. {
  3. Sunday=0,
  4. Monday=1,
  5. Tuesday=2,
  6. Wednesday=3,
  7. Thursday=4,
  8. Friday=5,
  9. Saturday=6,
  10. }
  11.  
  12. // In the form Load event, bind the combobox to the data source.
  13. private void Form1_Load(object sender, EventArgs e)
  14. {
  15.  
  16.  
  17. comboBox2.DataSource = Enum.GetValues(typeof(MyEnumType));
  18. comboBox2.SelectedItem = MyEnumType.Friday;
This should be more or less:

enum-id MyEnumType.
78 Sunday value 0.
78 Monday value 1.
78 Tuesday value 2.
78 Wednesday value 3.
78 Thursday value 4.
78 Friday value 5.
78 Saturday value 6.
end enum.

class-id a.
method-id Form1_Load(sender as object, e as type EventArgs).
set comboBox2::DataSource to type Enum::GetValues(type of MyEnumType)
set comboBox2::SelectedItem to type MyEnumType::Friday
end method.
end class.

 How would one rewrite the Enum.GetNames(typeof(MyEnumType)) syntax to .net cobol.  I am trying to populate my combobox with an enum and I cannot figure out the syntax for the GetNames().

  1. public enum MyEnumType
  2. {
  3. Sunday=0,
  4. Monday=1,
  5. Tuesday=2,
  6. Wednesday=3,
  7. Thursday=4,
  8. Friday=5,
  9. Saturday=6,
  10. }
  11.  
  12. // In the form Load event, bind the combobox to the data source.
  13. private void Form1_Load(object sender, EventArgs e)
  14. {
  15.  
  16.  
  17. comboBox2.DataSource = Enum.GetValues(typeof(MyEnumType));
  18. comboBox2.SelectedItem = MyEnumType.Friday;
Thanks Robert. I was staring at this way too long and the answer was right in front of me. I was trying to mimic the C# code by using typeof not realizing I could use type of.