D
D
Denis2021-03-22 21:31:41
C++ / C#
Denis, 2021-03-22 21:31:41

What (probably reference data type) for the TextBox?

I know that there are standard data types such as int , char , long , decimal and so on and so forth... They all belong to System , there are more reference types object , string , I can convert from object to int for example. But there is also in winforms , for example, the type (or whatever it is called) TextBox , Button , Label ... Which (probably more reference type) from which I can convert not to int , but to TextBox or Label. On the example of the starting point, which is of no interest to anyone.

private void textBox1_MouseMove(object sender, MouseEventArgs e)
        {
            textBox1 = (TextBox)sender;
        }

I need something like this...
private void move(Control control , object sender)
        {
            control obj = (control)sender;
        }

This looks absurd...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RealLazyCat, 2021-03-22
@RealLazyCat

TextBox, Button, Label are all visual components. These are the same classes + visual component (by the way, you can do it yourself). What you are trying to do is called type casting.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question