Associateing Enums
Posted: Thu Jul 03, 2008 5:28 pm
I have a application that edits the many stored bytes of a file. It opens a file and displays the editable information in combo boxes but I can never make it actually read the byte and display the associated information. Say I have this in a read function:
reader.BaseStream.Position = 0xblahblah;
Charactertype Ctype = (Charactertype)reader.ReadByte();
this.combobox.SelectedIndex = (int)Ctype;
playerType = (int)Ctype;
And I have this as my enum:
public enum Charactertype : byte
{
chartype1 = 0xblah,
chartype2 = 0xblah
}
And this as my combobox entries:
chartype1
chartype2
How would I make my read function Read the byte and Select the correct combo box entry? I will also need it to save information if the user changes the entry.
reader.BaseStream.Position = 0xblahblah;
Charactertype Ctype = (Charactertype)reader.ReadByte();
this.combobox.SelectedIndex = (int)Ctype;
playerType = (int)Ctype;
And I have this as my enum:
public enum Charactertype : byte
{
chartype1 = 0xblah,
chartype2 = 0xblah
}
And this as my combobox entries:
chartype1
chartype2
How would I make my read function Read the byte and Select the correct combo box entry? I will also need it to save information if the user changes the entry.