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.
Associateing Enums
Re: Associateing Enums
Have you already added the entries to the combobox?
If so then it should work...but try using Decimals instead of hex
reader.BaseStream.Position = -Decimal Offset-;
Charactertype Ctype = (Charactertype)reader.ReadByte();
this.combobox.SelectedIndex = (int)Ctype;
playerType = (int)Ctype;
public enum Charactertype : byte
{
chartype1 = -Decimal Byte-,
chartype2 = -Decimal Byte-
}
And this as my combbox entries:
chartype1
chartype2
If so then it should work...but try using Decimals instead of hex
reader.BaseStream.Position = -Decimal Offset-;
Charactertype Ctype = (Charactertype)reader.ReadByte();
this.combobox.SelectedIndex = (int)Ctype;
playerType = (int)Ctype;
public enum Charactertype : byte
{
chartype1 = -Decimal Byte-,
chartype2 = -Decimal Byte-
}
And this as my combbox entries:
chartype1
chartype2
Halo 2 Plugins | Lock-on To Just About Anything | My Sites | Snow Hog
Old Plugins you have, upgrade you must...
Always Maintain a High Quality-To-Crap Ratio.