Click here to Skip to main content
15,886,788 members
Home / Discussions / C#
   

C#

 
GeneralRe: FlushFinalBlock problem in my cryptography Pin
Mazdak12-Jan-04 22:36
Mazdak12-Jan-04 22:36 
GeneralRe: FlushFinalBlock problem in my cryptography Pin
Heath Stewart13-Jan-04 2:50
protectorHeath Stewart13-Jan-04 2:50 
GeneralRe: FlushFinalBlock problem in my cryptography Pin
Mazdak13-Jan-04 2:56
Mazdak13-Jan-04 2:56 
GeneralRe: FlushFinalBlock problem in my cryptography Pin
Heath Stewart13-Jan-04 3:00
protectorHeath Stewart13-Jan-04 3:00 
GeneralRe: FlushFinalBlock problem in my cryptography Pin
Mazdak13-Jan-04 4:02
Mazdak13-Jan-04 4:02 
GeneralEntering Text on an Image Pin
JayTheK12-Jan-04 10:08
JayTheK12-Jan-04 10:08 
GeneralRe: Entering Text on an Image Pin
Niels Penneman12-Jan-04 10:14
Niels Penneman12-Jan-04 10:14 
GeneralObject property with different return types Pin
Articus12-Jan-04 7:13
Articus12-Jan-04 7:13 
I have a control 'MyControl' with a property of type 'MyObject'. MyObject has a property 'MyField' that is a enum type. I want the type of enum to vary depending on a another property of MyObject called 'MyFieldType'. E.g. if MyFieldType = TypeA, MyField returns EnumA. See code below:

public enum FieldTypes
{
TypeA,
TypeB
}

public enum EnumA
{
Big,
Medium,
Small
}

public enum EnumB
{
Short,
Tall,
Squat,
Huge
}

[DefaultProperty("MyFieldType")]
public class MyObject
{
private FieldTypes m_MyFieldType;
private object m_MyField = 0;

public FieldTypes MyFieldType
{
get {return m_MyFieldType;}
set {m_MyFieldType = value;}
}

public object MyField
{
get
{
if (MyFieldType == FieldTypes.TypeA)
{
return (EnumA)m_MyField;
}
else
{
return (EnumB)m_MyField;
}
}
set
{
m_MyField = value;
}
}
}


My problem is that the MyField property is not editable via a dropdown list in the designer. It appears as a greyed-out (read only) string representation of the respective enum (EnumA or EnumB). I've tried writing a TypeConverter (inheriting from EnumConverter) but just ended up going round in circles.

Does anyone have an example of what I'm trying to do or point me in the right direction?

Thanks
GeneralRe: Object property with different return types Pin
leppie12-Jan-04 8:16
leppie12-Jan-04 8:16 
GeneralRe: Object property with different return types Pin
Articus12-Jan-04 22:41
Articus12-Jan-04 22:41 
GeneralRe: Object property with different return types Pin
leppie13-Jan-04 6:16
leppie13-Jan-04 6:16 
GeneralRefresh TreeView in Place Pin
webdudeIA12-Jan-04 5:24
webdudeIA12-Jan-04 5:24 
GeneralRe: Refresh TreeView in Place Pin
Heath Stewart12-Jan-04 8:48
protectorHeath Stewart12-Jan-04 8:48 
GeneralRe: Refresh TreeView in Place Pin
webdudeIA12-Jan-04 10:17
webdudeIA12-Jan-04 10:17 
GeneralEnumerations Pin
Anonymous12-Jan-04 4:10
Anonymous12-Jan-04 4:10 
GeneralRe: Enumerations Pin
Colin Angus Mackay12-Jan-04 5:56
Colin Angus Mackay12-Jan-04 5:56 
GeneralRe: Enumerations Pin
Niels Penneman12-Jan-04 5:58
Niels Penneman12-Jan-04 5:58 
GeneralRe: Enumerations Pin
Heath Stewart12-Jan-04 8:38
protectorHeath Stewart12-Jan-04 8:38 
QuestionUnregister Server Activated Object ? Pin
Stefan Troschuetz12-Jan-04 2:35
Stefan Troschuetz12-Jan-04 2:35 
AnswerRe: Unregister Server Activated Object ? Pin
Heath Stewart12-Jan-04 3:57
protectorHeath Stewart12-Jan-04 3:57 
GeneralRe: Unregister Server Activated Object ? Pin
Stefan Troschuetz12-Jan-04 5:54
Stefan Troschuetz12-Jan-04 5:54 
GeneralCould not load type. Pin
Simon Wren12-Jan-04 1:16
professionalSimon Wren12-Jan-04 1:16 
GeneralRe: Could not load type. Pin
Heath Stewart12-Jan-04 2:38
protectorHeath Stewart12-Jan-04 2:38 
GeneralRe: Could not load type. Pin
Simon Wren12-Jan-04 2:54
professionalSimon Wren12-Jan-04 2:54 
QuestionButtons? Pin
thomasa12-Jan-04 0:41
thomasa12-Jan-04 0:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.