473,382 Members | 1,404 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,382 software developers and data experts.

Accessing dynamically created controls

Hi all,
I am trying to create a VB smart device application.
I create few buttons dynamically on form_load...

something like this:
Dim WithEvents BtnOperate As New OpenNETCF.Windows.Forms.Button2
Me.BtnOperate.Location = New System.Drawing.Point(20, 20)
Me.BtnOperate.Size = New System.Drawing.Size(150, 150)
Me.BtnOperate.TabIndex = 0
Me.BtnOperate.BackgroundImage = b

then i have a datareceived event in a module, where i receive a command to set focus on one of the buttons (for example left of the one that currently has a button), i tried this trough the property
like this:
Public Property CtrlFocus() As Integer
Dim i As Integer = Me.Controls.Count
Dim ctrl As Control
For Each ctrl In Me.Controls
If ctrl.Focused Then
Return ctrl.TabIndex
End If
End Get
Set(ByVal value As Integer)
Dim ctrl As Control
For Each ctrl In Me.Controls
If ctrl.TabIndex = value Then
End If
End Set
End Property

with this commands that are in my module...:
dim fm as new frm_main
index = fm.CtrlFocus
frm_main.ctrlfocus = index +1

but when i try this there is no controls in me.controls in property CtrlFocus!
How could I access dynamically created controls from another thread...or get a list of them...

Hope this is clear whats the problem.
May 8 '07 #1
1 1847
i think you can solve prob

i have used the follwing code in page load event to dynamically generate 5 text boxs.

Dim i As Integer
For i = 1 To 5
Dim txtBox As New TextBox
txtBox.ID = String.Format("txtBox{0}", i)

now i want to display those entered text in same page when i click on button..
so please help me out... its urgent
May 8 '07 #2

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

Similar topics

by: Jonathan Williams | last post by:
Hi, I have an object which inherits from WebControl (CUSTOM : WebControl) In this object I have code in which I add child contols: protected override void CreateChildControls() {...
by: R Duke | last post by:
I have tried everything I can think of to change the visible property of a design time created control from a dynamically created control's command event handler. Here is the scenario. I have...
by: Kamal Jeet Singh | last post by:
Hi Friends !! I am facing problem in controlling the dynamically created controls on web page. The problem Scenario is Scenario:- My requirement is to load the web user controls on the web...
by: CS Wong | last post by:
Hi, I have a page form where form elements are created dynamically using Javascript instead of programatically at the code-behind level. I have problems accessing the dynamically-created...
by: drakuu | last post by:
All, I created dynamically part of a table and its components such as text boxes etc... As you can see in the example below I created txtAddress textbox... Everything works perfectly until the...
by: omh | last post by:
I started to work on asp.net2.0 just about a month ago. I got a problem which may be minot for the .net Guru's.The problem is I created radiobuttonlist controls dynamically and I could not access the...
by: Kabo | last post by:
Hi there, I'm currently working on a C# application that deals with dynamically created TabPages based (each TabPage represents a file that has been opened). On each TabPage there is a...
by: karthik25 | last post by:
Hi, The following code creates a tab container, 5 tab panels, buttons, labels. I was able to add event handlers to the button. But how am i supposed to access the dynamically created labels? For...
by: semomaniz | last post by:
I have a form where i have created the form dynamically. First i manually added a panel control to the web page. Then i added another panel dynamically and inside this panel i created tables. I have...
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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...
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
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...

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.