I am trying to use C# after using VB for a while. The problem that i am facing right now, is resizing things.
In VB i would use the following:

Private Sub TextBox_Resize() handles mybase.sizechanged 'change the size of the text box when the size of the main control changes'

textbox1.width = width - 40 'the size of the textbox is 40 off the size of the control, to keep it 20 away from each wall'

end sub

How would i use the handles feature in C#
thanks
~Matt

Recommended Answers

All 2 Replies

You have to check in form resize event as per my understanding,

private void Form1_Resize(object sender, EventArgs e)
        {
            txtresize.Width = this.Width - 40;
        }

alternatively, take a look at the dock and anchor properties in the designer. They control the size and location of a control relative to its container.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.