Click here to Skip to main content
15,922,015 members
Home / Discussions / C#
   

C#

 
GeneralRe: How to get the text from ComboEditable Pin
Md. Marufuzzaman2-Jul-10 23:01
professionalMd. Marufuzzaman2-Jul-10 23:01 
Questionsugeno Pin
hamidhakimi2-Jul-10 20:49
hamidhakimi2-Jul-10 20:49 
AnswerRe: sugeno Pin
Pete O'Hanlon2-Jul-10 21:20
mvePete O'Hanlon2-Jul-10 21:20 
GeneralRe: sugeno Pin
OriginalGriff2-Jul-10 21:38
mveOriginalGriff2-Jul-10 21:38 
QuestionHow to set the cursor in Combo Pin
raju_shiva2-Jul-10 19:40
raju_shiva2-Jul-10 19:40 
AnswerRe: How to set the cursor in Combo Pin
Peace ON2-Jul-10 20:48
Peace ON2-Jul-10 20:48 
AnswerRe: How to set the cursor in Combo Pin
dan!sh 3-Jul-10 2:55
professional dan!sh 3-Jul-10 2:55 
QuestionChanging Return Type Of A Control Pin
Roger Wright2-Jul-10 19:16
professionalRoger Wright2-Jul-10 19:16 
Pardon me if I'm a little vague - I know what I want to do, but I'm not certain it's possible.

I want to build a control that can be set at design time to use different data types. My first attempt, now that I look at it from a distance, is obviously not going to work. To wit:

public SByte DataValue
        {
            get { return SByte.Parse(this.Text); }
            set { this.Text = value.ToString(); }
        }
        public Int16 DataValue
        {
            get { return Int16.Parse(this.Text); }
            set { this.Text = value.ToString(); }
        }


While it doesn't produce any syntax errors, it gives the compiler heartburn. I was thinking that I can have multiple methods of the same name but different types, but since the signature is the same for both methods, it creates ambiguity.

In the class declaration I've included an enum type and member to contain the types I want to be able to use this control with, and my thought was to make the type changeable at design time by changing the DataType property in the Designer, so that the same control could be used to collect different types of data. This would be set in the VS Designer as a Property of the control. The parent form for the control would be responsible for keeping track of which data type each instance of the control uses, but it would be freed from the task of converting inputs to the correct type and performing validation for each type, that being delegated to the control, itself.

My initial approach is clearly bogus, but I still think that it should be possible to do. My understanding of generic classes and methods is thin, but I suspect that I should be looking there for a solution. Can anyone suggest a smarter way to tackle this problem?
"A Journey of a Thousand Rest Stops Begins with a Single Movement"

AnswerRe: Changing Return Type Of A Control Pin
OriginalGriff2-Jul-10 21:47
mveOriginalGriff2-Jul-10 21:47 
GeneralRe: Changing Return Type Of A Control Pin
Roger Wright3-Jul-10 6:47
professionalRoger Wright3-Jul-10 6:47 
AnswerRe: Changing Return Type Of A Control Pin
DaveyM692-Jul-10 21:59
professionalDaveyM692-Jul-10 21:59 
GeneralRe: Changing Return Type Of A Control Pin
Roger Wright3-Jul-10 6:53
professionalRoger Wright3-Jul-10 6:53 
QuestionDisplaying Contents of an Array Pin
ASPnoob2-Jul-10 13:19
ASPnoob2-Jul-10 13:19 
AnswerRe: Displaying Contents of an Array Pin
Luc Pattyn2-Jul-10 14:03
sitebuilderLuc Pattyn2-Jul-10 14:03 
QuestionClick here to send data to sever!! [modified] Pin
yum 20102-Jul-10 13:13
yum 20102-Jul-10 13:13 
AnswerRe: Click here to send data to sever!! Pin
Peace ON2-Jul-10 18:34
Peace ON2-Jul-10 18:34 
GeneralRe: Click here to send data to sever!! Pin
yum 20103-Jul-10 11:26
yum 20103-Jul-10 11:26 
QuestionAmazon API and C# Pin
tonyonlinux2-Jul-10 10:16
tonyonlinux2-Jul-10 10:16 
AnswerRe: Amazon API and C# Pin
Abhinav S2-Jul-10 17:57
Abhinav S2-Jul-10 17:57 
GeneralRe: Amazon API and C# Pin
tonyonlinux2-Jul-10 18:39
tonyonlinux2-Jul-10 18:39 
QuestionChange Row background color based by cell value Pin
grmihel22-Jul-10 5:14
grmihel22-Jul-10 5:14 
AnswerRe: Change Row background color based by cell value Pin
Henry Minute2-Jul-10 7:07
Henry Minute2-Jul-10 7:07 
AnswerRe: Change Row background color based by cell value Pin
Henry Minute2-Jul-10 8:37
Henry Minute2-Jul-10 8:37 
GeneralRe: Change Row background color based by cell value [modified] Pin
grmihel25-Jul-10 0:43
grmihel25-Jul-10 0:43 
GeneralRe: Change Row background color based by cell value Pin
Henry Minute5-Jul-10 3:34
Henry Minute5-Jul-10 3:34 

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.