473,721 Members | 1,811 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Loop Control array

Hello,
Could you explain me,In VB6 using control array,and how
about VB.net.

Thanks
Nov 20 '05 #1
20 2384
Hi Samean,

A lot of methods, so tell what you want to archieve because a general one
does probably not help you.

Cor
Nov 20 '05 #2
Hi,

http://www.windowsforms.com/default....mID=16&mid=142

http://msdn.microsoft.com/library/de...et05132003.asp

Ken
---------------------------
"samean" <an*******@disc ussions.microso ft.com> wrote in message
news:70******** *************** *****@phx.gbl.. .
Hello,
Could you explain me,In VB6 using control array,and how
about VB.net.

Thanks
Nov 20 '05 #3

"samean" <an*******@disc ussions.microso ft.com> wrote in message
news:70******** *************** *****@phx.gbl.. .
Could you explain me,In VB6 using control array,and how
about VB.net.


For VB6, ask in microsoft.publi c.vb.general.di scussion, and for .NET, they
no longer exist.
Nov 20 '05 #4
>and for .NET, they no longer exist.

Are you sure of that, I though exactly the oposite.

Cor
Nov 20 '05 #5

"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:Os******** *****@TK2MSFTNG P12.phx.gbl...
and for .NET, they no longer exist.


Are you sure of that, I though exactly the oposite.


Control arrays no longer exist in .NET, I know that for sure. However, I may
have slightly misinterpreted the poster's question. I read "How do you loop
through a control array in VB6 and .NET?" The question may actually have
been, "How do I loop through controls? Please show me using a control array
in VB6 and however it's done in .NET."
Nov 20 '05 #6
Hi Jeff,

All controls exist as arrays now (or reference in a control.collect ions
however that is for me the same, it is uses Ilist).

That means that there are as I wrote more possibilities, I give here 3
however it is of course endless.

One which looks I thought the most as the one that was in VB6.
\\\needs two buttons and a label on a form
Dim btnArea As Button() = New Button() {Button1, Button2}
For Each btn As Button In btnArea
AddHandler btn.MouseLeave, AddressOf Button_MouseLea ve
Next
Private Sub Button_MouseEnt er(ByVal sender As Object, _
ByVal e As System.EventArg s)
Me.Label1.Text = DirectCast(send er, Button).Name
End Sub
///
The most standard one
\\\
For each btn as button in me.controls
if typeof btn Is Button then
bla bla bla
end if
next
///
And the one I like the most.
\\\
Private Sub Form1_Load(ByVa l sender As Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
doset(Me)
End Sub
Private Sub doSet(ByVal parentCtr As Control)
Dim ctr As Control
For Each ctr In parentCtr.Contr ols
AddHandler ctr.LostFocus, AddressOf meLostFocus
AddHandler ctr.GotFocus, AddressOf meGotFocus
doSet(ctr)
Next
End Sub
Private Sub meLostFocus(ByV al sender As Object, _
ByVal e As System.EventArg s)
last = DirectCast(send er, Control).Name
End Sub
Private Sub meGotFocus(ByVa l sender As Object, _
ByVal e As System.EventArg s)
DirectCast(send er, Control).Text = last
End Sub
///

I hope this gives some idea of going throug a control array?

Cor
Nov 20 '05 #7

"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:%2******** **********@TK2M SFTNGP10.phx.gb l...
All controls exist as arrays now (or reference in a control.collect ions
however that is for me the same, it is uses Ilist).


Well, it is NOT the same as what VB6 called a "control array," and I think
it's confusing to people who have used both to state that there are "control
arrays" in .NET. Most VB6'ers would assume that means that you can have
controls on a form named, for example:

txtData(0)
txtData(1)
txtData(2)
etc.
Nov 20 '05 #8
Jeff,

Did I say it is the same, you said there exist no array of controls in
VBNet.

However that was not the question of the OP. (As you stated already)

I know that it is not what was called in VB6 a control array, luckily not.

However there is the control.collect ion in every control which implements
from the same class as array does.

:-)

Cor
Well, it is NOT the same as what VB6 called a "control array," and I think
it's confusing to people who have used both to state that there are "control arrays" in .NET. Most VB6'ers would assume that means that you can have
controls on a form named, for example:

txtData(0)
txtData(1)
txtData(2)
etc.

Nov 20 '05 #9

"Cor Ligthert" <no**********@p lanet.nl> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Did I say it is the same, you said there exist no array of controls in
VBNet.
No, I didn't say "array of controls"; in fact I didn't use the term at all,
at first. The original poster said "control array" and I said they don't
exist in .NET:

-------------------------------------------- Could you explain me,In VB6 using control array,and how
about VB.net.


For VB6, ask in microsoft.publi c.vb.general.di scussion, and for .NET, they
no longer exist.
--------------------------------------------
Nov 20 '05 #10

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

Similar topics

4
18832
by: Kevin H | last post by:
Apologies in advance if this sounds slow-witted, but I didn't find it here. Need to populate some textboxes on a form. While I could hard code it (the number of options aren't that high), it would be more compact/efficient to use a loop. However, I haven't found anything that describes how to reference the textboxes sequentially ... evaluating the hard part of the textbox name, with the number of the loop iteration, to address the...
5
2208
by: Blankdraw | last post by:
I can't get this nested loop to break the outer loop at the 5th data value so control can proceed to the next array col and continue pigeon-holing the next 5 in its own column. Why can I not get this nested loop to make sense? This is the last holdup to completion of my silly project. Explaining it from the inside - out, I want to fill a 120-col X 40-row array with data from a file containing 120 data records of 5 2-digit entries per...
8
16341
by: Brian Keating EI9FXB | last post by:
Would I be correct in saying that the only way to get a user message into a Windows form would be to use P/Invoke with Message? Of is there some part of the .NET API that I am totally un aware of? Thanks for any help Brian
8
42173
by: Tim | last post by:
On my form I have 10 checkboxes named chkbox1,chkbox2,....chkbox10. I would have like to set it up as an array control like in VB6 where I could have chkbox(1),chkbox(2) but I think .net you have to have specific names for each control. All 10 of the boxes are in a groupbox. What I'm trying to do is when I hit a button it will loop through all the checkboxes to see which ones are checked and add that checkbox name to a string. Something...
3
1318
by: jcrouse | last post by:
I am trying trying to loop through some label controls and setting some properties for the labels I'm looping through. Currently I am addressing the labels one at a time with IF...Then logic, like this: If lblP1JoyUp.BorderStyle = BorderStyle.FixedSingle Then lblP1JoyUp.Top = 10
20
2023
by: hufaunder | last post by:
I have 16-bit data that I want to display. In order to display it I compress a certain range of the input data into 8 bit (I need control over this). All seems to work ok except that it is dead slow both in release and debug mode. The main problem is the for-loop shown in the code bellow. Without the for-loop I can get somewhere around 10-20 updates/second. With the for-loop I get an update every 2-3 seconds. The strange thing is that when...
6
7266
by: Svein Erik | last post by:
C# asp.net 2.0. I'm creating an online survey. I'm making a string array that's holding the variables of the answers made in the radiobuttonlists that i create manually. I need to make a method that loops through all the radiobuttonlists and puts the selected answers in the string array that i've created. I guess this is relatively easy, but I haven't figured it out..here's the code that I have for now: protected void...
26
10212
by: Alexander Korsunsky | last post by:
Hi! I have some code that looks similar to this: -------------------------------------------- char array = "abcdefghij"; for (int i = 0; i < 10; i++) {
2
3225
by: recordlovelife | last post by:
So I am trying to display a title, date, and content of a wordpress blog. Word press provides nice drop in functions to get the job done with simple names like "the_title", and the "the_content" But on the homepage of a site, i wanted to truncate the content to like the first 75 characters and then put "..." (a perfect use of the smarty "truncate" modifier) and then give the visitor a link to read the whole article. But since "the_content" is a...
0
8834
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
8727
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
9212
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...
0
9056
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...
0
8002
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6664
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
4483
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4748
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2127
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.