472,131 Members | 1,400 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

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(oCountries.getCountries)

Dim tr As TableRow = New TableRow

Dim td As TableCell = New TableCell

btCountry = New Button

AddHandler btCountry.Click, AddressOf CountryButtClick

btCountry.OnClientClick = "waitForIt()"

btCountry.Attributes.Add("class", "dButtons")

btCountry.CommandArgument = oCountries.getCountries(i).id

btCountry.BackColor = Drawing.Color.Transparent

btCountry.BorderStyle = BorderStyle.None

btCountry.Text = oCountries.getCountries(i).Name

td.Controls.Add(btCountry)

tr.Cells.Add(td)

countryTable.Rows.Add(tr)

Next
Dec 29 '06 #1
2 1068
"Slim" <me@here.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
For i = 0 To UBound(oCountries.getCountries)
For i = 0 To UBound(oCountries.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**@markNOSPAMrae.comwrote in message
news:uc**************@TK2MSFTNGP04.phx.gbl...
"Slim" <me@here.comwrote in message
news:%2****************@TK2MSFTNGP04.phx.gbl...
>For i = 0 To UBound(oCountries.getCountries)

For i = 0 To UBound(oCountries.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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Peter Row | last post: by
4 posts views Thread by Larry Morris | last post: by
4 posts views Thread by Seraph | last post: by
4 posts views Thread by ShaneFowlkes | last post: by
2 posts views Thread by ann | last post: by
reply views Thread by Daniel | last post: by
2 posts views Thread by John Kotuby | last post: by
18 posts views Thread by joaotsetsemoita | last post: by
3 posts views Thread by =?Utf-8?B?QmFycnkgR2lsYmVydA==?= | last post: by

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.