hi all,
when writing a single data (f.e. 'F' or '2') in a textbox, is it possible to get the type of this data
when i try to get the type by myTextbox.GetType() everything is a string...
is there any way, to get the type of the data, that is written in a textbox
thanks in advance,
.k

DataType
Vladimir Savinov
But remember, these methods test in Unicode context, for example there are more letters than the ones in the latin alphabet (A-Z) and if you need only these use (Char.IsLetter(c) && c <= 0x007a) test.
Marfig
but i guesss there is no way to just get the type ...
with convert.to* i can convert to whatever i want to, but i only need to know what type the data is...
markp5511
you can use the static methods in the Convert class to check type.
Convert.To*() where * is a type
Convert.ChangeType()
sonali1754
<TextBox KeyDown="OnKeyDownHandler" />
Then in the code beside file, you define the event handler as follows:
void OnKeyDownHandler(Object sender, KeyEventArgs e)
{
if ((e.Key < Key.NumPad0 || e.Key > Key.NumPad9)
&& (e.Key < Key.D0 || e.Key > Key.D9)
&& (e.Key != Key.Back))
{
// Prevent non-numeric characters from being entered by user.
e.Handled = true;
}
}
Sheva