Hi there,
Could anybody tell me how, using VB.NET, I can display
the contents of a 2-dimensional array on a form in
response to an event.
The array is 20 X 6 cells and I don't want to have to
declare 120 separate labels in my form. I was looking to
use a control array for this, but these are not supported
in VB.NET.
I am quite new to VB in general, so please bear with me
if this is a very basic request.
My development environment is Windows XP professional SP1
and I am running the latest version of Visual Studio .NET
to do my development work.
Thanks. 4 4851
Hi GHJ,
I think the best think you can do is look for the "for next" program
control
Something like (absolute pseudo code) I don't know nothing how you
constructed your array.
\\\
dim i,y as integer
for i = 0 to a-array.length - 1
for y = 0 to b-array.length - 1
'do something with array(i,y)
next
next
///
I hope this helps a little bit.
Cor
* "GHJ" <gh*********@btopenworld.com> scripsit: Could anybody tell me how, using VB.NET, I can display the contents of a 2-dimensional array on a form in response to an event.
The array is 20 X 6 cells and I don't want to have to declare 120 separate labels in my form. I was looking to use a control array for this, but these are not supported in VB.NET.
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>
I am quite new to VB in general, so please bear with me if this is a very basic request.
Instead of using controls, you may want to draw the data onto the form
in its 'Paint' event handler ('e.Graphics.DrawString').
--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Hi GHJ,
I misread it, as addition to Herfried.
This is an example with buttons one dimensional array of controls,
\\\
Private mybutton(31) As Button
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim start As Integer = 4
Dim top As Integer = 25
Dim i As Integer
For i = 0 To System.DateTime.DaysInMonth(2003, 10) - 1
mybutton(i) = New Button
mybutton(i).TextAlign = ContentAlignment.MiddleCenter
mybutton(i).Width = 40
mybutton(i).Height = 20
mybutton(i).FlatStyle = FlatStyle.Flat
mybutton(i).BackColor = Drawing.Color.AntiqueWhite
mybutton(i).Location = New System.Drawing.Point(start, top)
mybutton(i).Text = (i + 1).ToString
mybutton(i).Cursor = Cursors.Hand
Me.Controls.Add(mybutton(i))
AddHandler mybutton(i).Click, AddressOf mybutton_Click
start = start + 40
If (i + 1) Mod 5 = 0 Then
top = top + 20
start = 4
End If
Next
End Sub
Private Sub mybutton_Click _
(ByVal sender As Object, ByVal e As System.EventArgs)
Dim month As Button = DirectCast(sender, Button)
MessageBox.Show("The day is: " & month.Text)
End Sub
End Class
///
I hope this helps a little bit?
Cor
Thanks to all who responded with your ideas. I have gone for the
datagrid option. Having a few minor problems but getting there.
Once again thanks a lot.
GHJ.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: mcp6453 |
last post by:
I am trying to use Jack's FormMail script
(http://www.dtheatre.com/scripts/formmail). Since I'm brand new at PHP
and not very good at HTML, I have an easy question, which I will narrow
down. When...
|
by: Foxy Kav |
last post by:
Hi everyone, Im currently doing first year UNI, taking a programming
course in C++, for one project i have to create a simple array
manipulator... that i have done, but i cant figure out how to...
|
by: Mannequin* |
last post by:
Hi all,
I'm working on a quick program to bring the Bible into memory from a
text file. Anyway, I have three questions to ask.
First, is my implementation of malloc () correct in the program to...
|
by: Simon Harvey |
last post by:
Hi,
I'm hoping someone can help me witht he following problem:
I have a fairly simple page that has a sort form and a button for adding the
forms details to an arraylist.
When the button is...
|
by: Melvin G. Sheppers |
last post by:
I want to display the time in a particular timezone (US Central) regardless
where the computer is located. I have written the script below which
displays the time in the Eastern, Central, Mountain,...
|
by: Marcus Kwok |
last post by:
I have written a class (Windows Form) in Managed C++ that accepts an
array of image filenames and will display them sequentially. All images
will be the same size. I got it to work, but I know...
|
by: gunimpi |
last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431
********************************************************
VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help
wanted...
|
by: sorobor |
last post by:
dear sir ..
i am using cakephp freamwork ..By the way i m begener in php and javascript ..
My probs r bellow
I made a javascript calender ..there is a close button ..when i press close button...
|
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: 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: 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: 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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
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,...
| |