i did this beacuse i want that when i will make the window bigger he will grow as it shuld be:

public Form1()
        {
            InitializeComponent();
            new Form1(ref webBrowser3, new Size(50, 50));
        }

        private void Form1_Resize(object sender, EventArgs e)
        {
           UpdatewebBrowser3(new Size(256 + (this.Width - this.MinimumSize.Width), 256 + (this.Height - this.MinimumSize.Height)));
        }

some one can tell me whats wrong with it?? cus its not working

Dani AI

Generated

Quick diagnostic and practical fixes for (building on 's breakpoint suggestion):

If the Resize handler never runs, first confirm it is actually attached to the visible form. Put a breakpoint or a Debug.WriteLine at the start of the handler. Check the Form's Events in the Designer (lightning bolt) or look in InitializeComponent to confirm the Resize assignment; if wiring is done manually, do it after InitializeComponent. If the handler runs but the control does not change, an exception inside the handler can abort the resize logic silently—watch the Output window or debugger.

Common pitfalls and better approaches:

  • Do not operate on a different form instance than the one shown. Creating or modifying another Form object will have no visible effect on the displayed window.
  • Prefer layout features instead of manual size math: set the control's Dock or Anchor properties or host it in a TableLayoutPanel/FlowLayoutPanel to handle resizing automatically.
  • If you need explicit response to the final size (after layout), consider the SizeChanged event as an alternative to Resize.

Quick checklist:

  1. Verify the handler is attached and hit by a breakpoint.
  2. Confirm you are modifying the current form instance.
  3. Use Dock/Anchor or layout panels where possible.
  4. Watch for swallowed exceptions and for MinimumSize/MaximumSize limits.

See , Control.SizeChanged, and for details.

Recommended Answers

All 4 Replies

i need help pls~!!

Is the event not doing as you expect or is it not firing?

its not do enything

That still doesnt really help. Have you put a breakpoint at the start of the event handler. Does the event handler execute when the form is resized?

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.