473,509 Members | 3,039 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Position Control when Created dynamically

Lou
I have a menu item that creates a new command button.
Each time I create a new command button I need to position it to the left of
the last created button.
In VB6 I could create a control array, look at the UBound of the array (Last
control Created) and find the
position of the last created control in order to place any new controls next
to it.
Creating controls in DotNet is different. I can create the controls
dynamically but have no
way of getting the co-ordinates of the previously created control since
there is no index property.

-Lou
Feb 8 '07 #1
7 1256
Lou,

Of course is there an index property.
The first in an array is 0.

So the previous control is when it is not zero this index -1

Cor

Feb 8 '07 #2
Cor, you're talking about the TabIndex, right?

Robin S.
------------------------------
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:e$**************@TK2MSFTNGP05.phx.gbl...
Lou,

Of course is there an index property.
The first in an array is 0.

So the previous control is when it is not zero this index -1

Cor

Feb 8 '07 #3
Cor, you're talking about the TabIndex, right?
no .

dim mycontrolarray() as control = {Button1, TextBox2, TextBox4, Button2}

The indexes are in that case 0, 1,2,3

Cor

Feb 8 '07 #4
Lou
There is no index property of a button
I thought you could not have an array of controls in DotNet.
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:O6**************@TK2MSFTNGP02.phx.gbl...
>
>Cor, you're talking about the TabIndex, right?

no .

dim mycontrolarray() as control = {Button1, TextBox2, TextBox4, Button2}

The indexes are in that case 0, 1,2,3

Cor

Feb 8 '07 #5
On Feb 8, 7:42 am, "Lou" <lou.gar...@comcast.netwrote:
There is no index property of a button
I thought you could not have an array of controls in DotNet.

"Cor Ligthert [MVP]" <notmyfirstn...@planet.nlwrote in messagenews:O6**************@TK2MSFTNGP02.phx.gbl. ..
Cor, you're talking about the TabIndex, right?
no .
dim mycontrolarray() as control = {Button1, TextBox2, TextBox4, Button2}
The indexes are in that case 0, 1,2,3
Cor
He's talking about the index of an array that contains the control,
not the old VB6 index property.

Thanks,

Seth Rowe

Feb 8 '07 #6
Yeah, that's what I suspected, but it wasn't clear. The OP is thinking
about control arrays as they existed in VB6.

Robin S.
-------------------------------------
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:O6**************@TK2MSFTNGP02.phx.gbl...
>
>Cor, you're talking about the TabIndex, right?

no .

dim mycontrolarray() as control = {Button1, TextBox2, TextBox4, Button2}

The indexes are in that case 0, 1,2,3

Cor

Feb 9 '07 #7
You can put them in an array yourself in the code behind the form, as Cor
has done in his example.

Robin S.
------------------------------------
"Lou" <lo********@comcast.netwrote in message
news:up**************@TK2MSFTNGP05.phx.gbl...
There is no index property of a button
I thought you could not have an array of controls in DotNet.
"Cor Ligthert [MVP]" <no************@planet.nlwrote in message
news:O6**************@TK2MSFTNGP02.phx.gbl...
>>
>>Cor, you're talking about the TabIndex, right?

no .

dim mycontrolarray() as control = {Button1, TextBox2, TextBox4, Button2}

The indexes are in that case 0, 1,2,3

Cor


Feb 9 '07 #8

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

Similar topics

1
1795
by: Karl Seguin | last post by:
i have a dynamically created user control which contains a non-dynamically created ASP.Net button. When the button is clicked, the event is not fired. I know that the control must be created on...
0
2098
by: John Crowley | last post by:
I'm having an odd problem with viewstate and a dynamically created control inside a repeater template. Basically, I have a repeater setup like this in the aspx:
7
2320
by: Sky | last post by:
What I have currently: I have a user control called mod_container.aspx that is basically two divs -- the top a toolbar, that expands/collapse the second div which can contain other...
3
2258
by: Eric | last post by:
I have built a composite user web control that I want to create dynamically. The form will contain a variable number of these controls and as well some of the contents of the user web control...
2
2910
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...
7
7562
by: mef526 | last post by:
I would like to reference a dynamically created control and I know the name. I would like to use the following: Dim strName as String = "txtControl1" ' This is the ".Name" used when textbox was...
9
3165
by: Gummy | last post by:
Hello, I created a user control that has a ListBox and a RadioButtonList (and other stuff). The idea is that I put the user control on the ASPX page multiple times and each user control will...
3
2267
by: EricW | last post by:
I want to create my homepage completely dynamically, but when I create two imagecontrols and want to position them, they won't move at all. I've read some artikels about using the placeholder,...
9
7908
by: Chris | last post by:
I am dynamically adding a user control to each row in a gridview. The reason I am doing it dynamically is the user control is different depending on certain data in the gridview. The gridview...
0
7234
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
7136
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
7344
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
7412
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...
0
7505
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...
0
5652
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,...
0
3216
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3203
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1570
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.