Repetition

B

Bart

Dear all,

I have a problem that I cannot understand the reason of.
My code is

private void ButtDetl_Click(object sender, System.EventArgs e)
{
// give an information of the sender
int num=this.GetNumber(((Button)sender).Name);
//check if there is a TextBox with same number of the sender after
"TextExpl"
foreach (Control c in this.Controls)
{
if (c.GetType().Name=="TextBox"&&c.Name=="TreeExpl"+num.ToString())
// setup the DtBox
this.DtBox=(TextBox)c;
}
//insert Explanation Form if DtBox is not null
this.InsExplanation(DtBox);
}

Sometimes the line
this.InsExplanation(DtBox);
is done three or four times without a reason, inserting the same Explanation
Form (in my case) three or four times!!! Furthermore when I open my
application the Application_Load(object sender, System.EventArgs e) is
repeted 2 times.
Any suggestion?

Thank you,

Bart
 
G

Guest

go to the HTML view of the form and check this line
<%@ Page language="c#" Codebehind="A.aspx.cs" AutoEventWireup="false"
Inherits="A.WebForm1" %>

AutoEventWireup is it set to true?
it should be set to false.

hope this helped,
Kannan.V
 
B

Bart

Kannan.V said:
go to the HTML view of the form and check this line
<%@ Page language="c#" Codebehind="A.aspx.cs" AutoEventWireup="false"
Inherits="A.WebForm1" %>

AutoEventWireup is it set to true?
it should be set to false.

Actually I'm not using ASP.Net, just C# and Windows Form.....
I tried many methods, but always same problem...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top