473,574 Members | 2,350 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Event firing twice

I have loop that builds table rows, it also attaches events, this works fine
on all but the last row, where the event fires twice

I have autowireup set to false

any ideas?

For i = 0 To UBound(oCountri es.getCountries )

Dim tr As TableRow = New TableRow

Dim td As TableCell = New TableCell

btCountry = New Button

AddHandler btCountry.Click , AddressOf CountryButtClic k

btCountry.OnCli entClick = "waitForIt( )"

btCountry.Attri butes.Add("clas s", "dButtons")

btCountry.Comma ndArgument = oCountries.getC ountries(i).id

btCountry.BackC olor = Drawing.Color.T ransparent

btCountry.Borde rStyle = BorderStyle.Non e

btCountry.Text = oCountries.getC ountries(i).Nam e

td.Controls.Add (btCountry)

tr.Cells.Add(td )

countryTable.Ro ws.Add(tr)

Next
Dec 29 '06 #1
2 1123
"Slim" <me@here.comwro te in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
For i = 0 To UBound(oCountri es.getCountries )
For i = 0 To UBound(oCountri es.getCountries ) - 1

I'm actually quite surprised your code doesn't generate an "index out of
bounds" error...
Dec 29 '06 #2

"Mark Rae" <ma**@markNOSPA Mrae.comwrote in message
news:uc******** ******@TK2MSFTN GP04.phx.gbl...
"Slim" <me@here.comwro te in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>For i = 0 To UBound(oCountri es.getCountries )

For i = 0 To UBound(oCountri es.getCountries ) - 1

I'm actually quite surprised your code doesn't generate an "index out of
bounds" error...
If I put a -1 I get one value short, its when you use the count property you
need to use -1, I always get them mixed up myself.

But I found my problem, I was attaching a event plus I had the "handles
btCountry.Click " on the event also.


Dec 29 '06 #3

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

Similar topics

3
4889
by: Peter Row | last post by:
Hi, I have created a user control consisting of a textbox and a separate vertical scroll bar. The textbox is filled with data. However there could be lots of data so I only fill the textbox with enough to fill the space visible without scrolling. Having set the min and max values of my separate vertical scrollbar I use that to scroll the...
4
6079
by: Larry Morris | last post by:
The following code, pasted into a web form with a link button on it, will cause the page_unload event to fire twice. If I remove the response.redirect, the problem goes away :). I've got a work around, but I'm curious how one is supposed to programmatically navigate between web pages without the page_unload event firing twice. Thanks, ...
4
3962
by: Seraph | last post by:
Again, I'm rather new here, so if I fail to follow any etiquette, please forgive me and let me know what I've done wrong, but I think this might interest quite a few people. One of my colleaques was endeavoring to create a custom user control to make things a bit simpler, but she noticed that her Page_Load eventhandler was firing twice. So...
4
4280
by: ShaneFowlkes | last post by:
I have a odd thing happening. I have a sub that is called upon a button click and it seems to be firing TWICE. I have no idea how this is happening but I suspect is has something to do with page_load and IsPostBack. The page has a form that displays a record. The user can delete the record by clicking a delete button or update it by...
2
1445
by: ann | last post by:
I have a datagrid control I am using - the edit & update events are firing twice. I searched on google and see others have had same issue not just with datagrid but with other controls, but no resolution except to try "AutoEventWireup="false" , which it already is and it doesn't fix it. Can anyone help me? c# & net 1.1 thanks
14
8653
by: TS | last post by:
I have this custom data list control and i override the onItemDatabound event. After upgrading to vs 2005, this event is not always getting called, though it does at other times. No changes were made when upgrading to 2.0 is there any reason for this because of .net 2.0? thanks
0
1313
by: Daniel | last post by:
I've created a custom control including some Literal ( constructed with html markup) and an ImageButton firing event ( add a vote ). public event VoteCommandEventHandler VoteCommand; protected override void CreateChildControls() { LiteralControl ltrBeforeVote = new LiteralControl(buildMarkupBeforeVoteButton());...
2
3904
by: John Kotuby | last post by:
Hi guys, I am converting a rather complicated database driven Web application from classic ASP to ASP.NET 2.0 using VB 2005 as the programming language. The original ASP application works quite well, so at times it is tempting just to port parts of it over mostly as-is. In fact, one MSDN article I read suggested using straight HTML wherever...
18
3928
by: joaotsetsemoita | last post by:
Hello everyone, I'm having troubles assigning an onclick event to a cell. Im trying something like cursorPoint.cells.style.cursor = "hand"; cursorPoint.cells.width = "20"; cursorPoint.cells.onclick = "alert('this is a test');" cursorPoint.cells.alt = "Select the columns"; cursorPoint.cells.innerHTML = "&nbsp;"
3
1558
by: =?Utf-8?B?QmFycnkgR2lsYmVydA==?= | last post by:
I have a class that raises events that downstream objects subscribe to. In one case, after destroying the object, the event seems to still get handled in a subscriber object. So I instantiate an object and the event fires correctly. Then I destroy the object and instantiate another instance and the subscriber event handler get hit twice. I've...
0
7828
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
8089
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8260
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7840
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6493
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5638
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5329
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1362
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1092
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.