I can't understand you well.
I does, what you wrote. My DBTextbox class:
public class dbText : System.Windows.Forms.TextBox
public object Value
{
get
{
return base.Text;
}
set
{
base.Text = value.ToString();
}
}
in a function of a form, I try to get value of the dbTextbox, which should be float, but I can't.
private void button1_Click(object sender, System.EventArgs e)
{
float sngValue = 1.234f;
dbtextbox1.Value = sngValue;
dbText2.Value = dbtextbox1.Value;
sngValue =(float) dbText2.Value.ToString() ;
}
How can I do this?
Thanks
Martin
"Jon Skeet [C# MVP]" <sk***@pobox.com> schrieb im Newsbeitrag news:MP************************@msnews.microsoft.c om...
Martin <ma******@freenet.de> wrote: Is there type VARIANT in C#?
No, but there is "object", which all types derive from eventually (sort
of, anyway- value types themselves don't derive from anything, but
their boxed equivalents do).
I use my class dbTextbox (which inherited from Textbox) to store and
display diferent values type from database. Therefore I want to
create property VALUE, which can have dif value types. How can I do
this? Is there any idea?
You can certainly declare it to return object.
--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too