473,383 Members | 1,733 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Why are events such as Resize, Click, DoublClick, etc. are not raised for a Windows Form?

Hello,

I have a strange situation. I create a very simple Windows Forms
application and place the code below however even though I place
breakpoints in various event handling points VS.NET 2005 only enters
the breakpoint for the button but not for the form. Am I missing
something? Why don't the events for my form Form1 have any effect?

Form1.cs:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace GeciciResize
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
}

private void Form1_Resize(object sender, System.EventArgs e)
{
// I place a breakpoint in the line below BUT it doesn't
enter here when I resize the form.
if (FormWindowState.Minimized == WindowState)
Form1.ActiveForm.Hide();
}
private void Form1_Click(object sender, System.EventArgs e)
{
// I place a breakpoint in the line below BUT it doesn't
enter here when I click on the form.
if (FormWindowState.Minimized == WindowState)
Form1.ActiveForm.Hide();
}

private void Form1_DoubleClick(object sender, System.EventArgs
e)
{
// I place a breakpoint in the line below BUT it doesn't
enter here when I double click on the form.
if (FormWindowState.Minimized == WindowState)
Form1.ActiveForm.Hide();
}

private void button1_Click(object sender, EventArgs e)
{
// I place a breakpoint in the line below AND it enters
here when I click on the button.
Form1.ActiveForm.Hide();
}
}
}

Regards,
Emre Sevinc

Aug 16 '07 #1
2 1771

Emre Sevinc wrote:
Hello,

I have a strange situation. I create a very simple Windows Forms
application and place the code below however even though I place
breakpoints in various event handling points VS.NET 2005 only enters
the breakpoint for the button but not for the form. Am I missing
something? Why don't the events for my form Form1 have any effect?

Form1.cs:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace GeciciResize
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
}

private void Form1_Resize(object sender, System.EventArgs e)
{
// I place a breakpoint in the line below BUT it doesn't
enter here when I resize the form.
if (FormWindowState.Minimized == WindowState)
Form1.ActiveForm.Hide();
}
private void Form1_Click(object sender, System.EventArgs e)
{
// I place a breakpoint in the line below BUT it doesn't
enter here when I click on the form.
if (FormWindowState.Minimized == WindowState)
Form1.ActiveForm.Hide();
}

private void Form1_DoubleClick(object sender, System.EventArgs
e)
{
// I place a breakpoint in the line below BUT it doesn't
enter here when I double click on the form.
if (FormWindowState.Minimized == WindowState)
Form1.ActiveForm.Hide();
}

private void button1_Click(object sender, EventArgs e)
{
// I place a breakpoint in the line below AND it enters
here when I click on the button.
Form1.ActiveForm.Hide();
}
}
}

Regards,
Emre Sevinc
Let me guess, this used to work with Visual Basic? ;)

You have to add event handlers:

In the main:
Form1.ActiveForm.Resize += new EventHandler(Form1_Resize);

_Then_ you can put code in Form1_Resize which will run when the form
is resized.

Aug 16 '07 #2
in case the event registration write under designer code, then maybe you
should clean the solution turn the solution to debug and rebuild the
solution, it will work.
--
Sincerely
Yaron Karni
http://dotnetbible.blogspot.com/
"Mahmoud Al-Qudsi" wrote:
>
Emre Sevinc wrote:
Hello,

I have a strange situation. I create a very simple Windows Forms
application and place the code below however even though I place
breakpoints in various event handling points VS.NET 2005 only enters
the breakpoint for the button but not for the form. Am I missing
something? Why don't the events for my form Form1 have any effect?

Form1.cs:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace GeciciResize
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
}

private void Form1_Resize(object sender, System.EventArgs e)
{
// I place a breakpoint in the line below BUT it doesn't
enter here when I resize the form.
if (FormWindowState.Minimized == WindowState)
Form1.ActiveForm.Hide();
}
private void Form1_Click(object sender, System.EventArgs e)
{
// I place a breakpoint in the line below BUT it doesn't
enter here when I click on the form.
if (FormWindowState.Minimized == WindowState)
Form1.ActiveForm.Hide();
}

private void Form1_DoubleClick(object sender, System.EventArgs
e)
{
// I place a breakpoint in the line below BUT it doesn't
enter here when I double click on the form.
if (FormWindowState.Minimized == WindowState)
Form1.ActiveForm.Hide();
}

private void button1_Click(object sender, EventArgs e)
{
// I place a breakpoint in the line below AND it enters
here when I click on the button.
Form1.ActiveForm.Hide();
}
}
}

Regards,
Emre Sevinc

Let me guess, this used to work with Visual Basic? ;)

You have to add event handlers:

In the main:
Form1.ActiveForm.Resize += new EventHandler(Form1_Resize);

_Then_ you can put code in Form1_Resize which will run when the form
is resized.

Aug 17 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: amit.purohit | last post by:
hi, I have a very strange problem on my login Page. the Page was working fine a few days back, but now does not generate post back events for controls. this login page uses form based...
3
by: Todd Schinell | last post by:
Back in July, Jeffery Tan posted this: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=OWOTdf0VDHA.2296%40cpmsftngxa06.phx.gbl In response as to how to get click events from a...
8
by: CJack | last post by:
hy, I have an mdi application, i create a child form and I want to know when a button is pressed while that child form is loaded. I have this code: private void frmTestBaby_KeyUp(object sender,...
4
by: Roberto López | last post by:
Hello, I´m trying to do a progress page that indicates some visual information to the user in a long directory copy process. I have a Class that copys directories from one location to other. The...
5
by: Jeff Ptak | last post by:
Can anyone tell me how to trap mouse click events in the Image control? I am trying to implement an image zoom feature using JavaScript where the user could "draw" a zoom box (aka rubber band...
1
by: Peter Sulikowski | last post by:
If I have a button for example on a form, is there a way that I can spy on which .Net events etc are being raised as I move over the button with the cursor, click on the button, leave input focus...
1
by: Apu Nahasapeemapetilon | last post by:
Hello and thank you in advance for your help. Can anyone think of a reason why this code would work properly on one PC, but not another? I've got a System.Windows.Forms.UserControl that...
4
by: Ty Salistean | last post by:
So, here is a wierd question that we have been discussing for a bit now. Does an event fire even though nothing is subscribed to listen to the event? For instance, does the Click event of a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.