473,396 Members | 2,011 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,396 software developers and data experts.

addhandler not working? Vb.net

For some reason i cannot understand, i cannot add a click event to these dynamically made panels. I have included my relevant code below...any help would be great.


Expand|Select|Wrap|Line Numbers
  1. Public Sub addlayer()
  2.         'make space
  3.         ReDim Preserve dynpan(intlayer)
  4.  
  5.         'create new panel and define propeties
  6.         dynpan(intlayer) = New Panel
  7.         Me.Controls.Add(dynpan(intlayer))
  8.         AddHandler dynpan(intlayer).Click, AddressOf doall_click
  9.         dynpan(intlayer).Visible = True
  10.         dynpan(intlayer).Height = Panbg.Height
  11.         dynpan(intlayer).Width = Panbg.Width
  12.         dynpan(intlayer).Parent = Panbg
  13.         dynpan(intlayer).Tag = intlayer
  14.         dynpan(intlayer).BackColor = Color.WhiteSmoke
the event it is supposed to call is below, it is intended to allow the user to click on the panel to create a label at the mouse cursor...it dosn't do this!

Expand|Select|Wrap|Line Numbers
  1.  n = libxlayer.Items.Count
  2.         Debug.Print("Hello")
  3.  
  4.  
  5.         If Tool = "Text" Then
  6.  
  7.             'define varibles
  8.             intelement = intelement + 1
  9.             CursorOffset = Windows.Forms.Cursor.Position
  10.             intheight = (Me.Height - panbg.Height) / 2
  11.             intwidth = (Me.Width - panbg.Width) / 2
  12.             sintxtsize = txtsize.Text
  13.  
  14.             'make space
  15.             ReDim Preserve dynlabel(intelement)
  16.  
  17.             'create new label and define propeties
  18.             Me.Controls.Add(dynlabel(intelement))
  19.             dynlabel(intelement) = New TextBox
  20.             dynlabel(intelement).Location = New Point((CursorOffset.X - intwidth), (CursorOffset.Y - intheight))
  21.             dynlabel(intelement).Parent = dynpan(n)
  22.             dynlabel(intelement).Text = "TYPE HERE"
  23.             dynlabel(intelement).Tag = intelement
  24.  
  25.  
  26.  
Sep 26 '07 #1
0 849

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: RA | last post by:
I have simpe code as follows. Private sub Page_load..... FillTable() End Sub Private Sub FillTable() '
2
by: Just Me | last post by:
When a document is to be printed I call a method that contains an AddHandler statement. I just realized that if a second copy is to be printed the method is called and the AddHandler is executed...
10
by: Rick Palmer | last post by:
I have an app I'm working on that will allow a user to run one of 5 reports. The report names are in a combobox on my form. I have a sub defined for each report that has the exact same name as is...
6
by: Carlo3030 | last post by:
Been reading Dino Esposito's Article "A DetailsView Control for ASP.NET 1.x" found in the msdn Library. His example was created using VB.NET. I am trying to convert the example (DetailsView...
3
by: Vemund Halvorsen | last post by:
Hi, Im having some trouble getting Addhandler to work. Using withevents everything is working fine. But with AddHandler I get no callback. The code below works fin if I declare _tcp as a...
5
by: Slim | last post by:
i have a simple page, with one button button1. when click it creates a new button button 2 and adds a event handler to it. but when button 2 is clicked nothing happens, why? Partial Class...
15
by: Nathan Sokalski | last post by:
I have a section of my code that dynamically creates LinkButtons to allow the user to go to the page containing a question they have not answered. The code that creates the LinkButton is called, as...
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
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,...
0
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...
0
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,...
0
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...

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.