473,726 Members | 2,262 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 1132
"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
4904
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 data. So for example the textbox could be displaying 50 lines of data but in actual fact there is...
4
6094
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, Larry
4
3988
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 after long hours of research and experimentation, I stumbled upon, imho, is quite the discovery. ...
4
4287
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 clicking an update button. The delete sub calls a couple of other subs and functions and then displays a...
2
1450
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
8679
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
1317
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()); this.Controls.Add(ltrBeforeVote );
2
3923
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 possible to make the app more efficient and less resource demanding. On one page there are 2...
18
3939
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
1569
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 tried using IDisposible and also using GC.Collect, but it didn't seem to help. I've also tried...
0
8889
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8752
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9257
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9179
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
9116
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6702
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.