I have just started using VB7 so I am new to all this.
In VB6 I used to array controls, but I notice that there is no Index
property in the VB7 controls. What's the answer please? 4 1171
Hi, http://msdn.microsoft.com/library/de...et05132003.asp
Ken
----------------------
"Broadbent" <he**@dwgman.com> wrote in message
news:br**********@hercules.btinternet.com... I have just started using VB7 so I am new to all this. In VB6 I used to array controls, but I notice that there is no Index property in the VB7 controls. What's the answer please?
Hi Broadbent
In addition to Ken
If you want it it is easy to make a control array here is a sample
\\\
Private myCheckbox(10) As CheckBox
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
'you need for this to drag a groupbox1
'and a button on the form
Dim start As Integer = 4
Dim top As Integer = 18
Dim i As Integer
For i = 1 To 10
myCheckbox(i) = New CheckBox
myCheckbox(i).TextAlign = ContentAlignment.MiddleCenter
myCheckbox(i).Width = 40
myCheckbox(i).Height = 20
myCheckbox(i).Location = New System.Drawing.Point(start, top)
myCheckbox(i).Text = i.ToString
myCheckbox(i).Cursor = Cursors.Hand
Me.GroupBox1.Controls.Add(myCheckbox(i))
AddHandler myCheckbox(i).Click, AddressOf myCheckBox_Click
start = start + 40
If i = 5 Then
top = top + 20
start = 4
End If
Next
End Sub
Private Sub myCheckBox_Click _
(ByVal sender As Object, ByVal e As System.EventArgs)
Dim chk As CheckBox
chk = DirectCast(sender, CheckBox)
Dim i As String = chk.Text
End Sub
Private Sub Button1_Click _
(ByVal sender As Object, ByVal e As System.EventArgs) _
Handles Button1.Click
Dim a As New System.Text.StringBuilder
a.Remove(0, a.Length)
Dim i As Integer
For i = 1 To 10
If myCheckbox(i).Checked Then
a.Append(i.ToString)
End If
Next
MessageBox.Show(a.ToString)
End Sub
///
I hope this helps a little bit?
Cor
"Broadbent" <he**@dwgman.com> schrieb I have just started using VB7 so I am new to all this. In VB6 I used to array controls, but I notice that there is no Index property in the VB7 controls. What's the answer please?
The former control arrays are not required anymore.
If you want to access controls by an index instead of by a more expressive
name, add them to an array:
dim m_labels() as label
'...
m_labels = new label(){lblName, lblStreet, lblWhatever}
--
Armin http://www.plig.net/nnq/nquote.html http://www.netmeister.org/news/learn2quote.html
* "Broadbent" <he**@dwgman.com> scripsit: I have just started using VB7 so I am new to all this. In VB6 I used to array controls, but I notice that there is no Index property in the VB7 controls. What's the answer please?
Creating Control Arrays in Visual Basic .NET and Visual C# .NET
<http://msdn.microsoft.com/library/?url=/library/en-us/dv_vstechart/html/vbtchCreatingControlArraysInVisualBasicNETVisualCN ET.asp>
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: jan Veenstra |
last post by:
Hi,
I am having two problems with Access 97. These '2 problems are posted
seperately in this newsgroup. Here's the first:
I have a form with lots of similar textboxes and I have a procedure...
|
by: TD |
last post by:
This is the code under a command button -
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.BackColor <> RGB(255, 255, 255) Then
ctl.BackColor = RGB(255, 255, 255)
End If
Next ctl
|
by: Mark Johnson |
last post by:
Sometimes Controls that have been added to a GroupBox do not show up.
What I am doing :
1) I am not using the designer, but create all the Controls per hand:
groupBoxProdukt_01 = new...
|
by: Robert Howells |
last post by:
Perhaps I'm just too new at this to pull it off, or perhaps it's just bad
architecture. I'd appreciate some feedback on the the wisdom (or lack
thereof) in attempting the following:
I'm not new...
|
by: Cor |
last post by:
Hi,
I start a new thread about a discussion from yesterday (or for some of us
this morning). It was a not so nice discussion about dynamically removing
controls from a panel or what ever.
It...
|
by: Mike Bulava |
last post by:
I have created a base form that I plan to use throughout my application let
call the form form1. I have Built the project then add another form that
inherits from form1, I add a few panel controls...
|
by: Arpan |
last post by:
Consider the following code which retrieves data from a SQL Server 2005
DB table & displays it in a DataGrid:
<script runat="server">
Sub Page_Load(ByVal obj As Object, ByVal ea As EventArgs)...
|
by: Ryan |
last post by:
Ok.. I have a form with lots of stuff on it; a tool strip panel, menu strip,
data binding elements (dataset, binding source, table adapter), tab control
with 7 tab pages, each page contains a...
|
by: phub11 |
last post by:
Hi all,
I have two pre-defined arrays;
array1 = car, 1, tony;
array2 = bus, 3, mike;
I would like to make these into an arrayed array such that arrayFinal=tony.
I've looked at...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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: 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: 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,...
|
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...
|
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,...
|
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...
|
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...
| |