By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,352 Members | 1,593 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,352 IT Pros & Developers. It's quick & easy.

Control arrays... the loss of (index As Integer)

P: n/a
Hello everyone,

I'm currently writing a program to keep track of schedule changes at a
school. The goal is to have someone using the program to declare changes,
then the program writes a html file, which is uploaded to a webserver. Then
students and teachers can view it online, but there are also a couple of
computers with 19" monitors standing around the school to display the
webpage (IE kiosk mode).

The program has a form containing a tab control. It holds one tabpage for
each day of schedule changes (students need to be able to know of schedule
changes at least one day ahead of time, javascript on the webpage will
autoredirect after a few seconds to make sure all pages can be viewed). Each
tabpage contains several textboxes in which the scheduler can type the
changes, as well as a few checkboxes for the html layout, and a button to
write and upload the html file. All tabpages are identical in layout (no
code written yet, in fact the layout isn't completed either, but that's
because I got stuck on the problem described below).

Now obviously I need the same parsing algorythm to parse data into the html
file on each tab, using the text boxes and checkboxes on that tab. I had
originally planned to have all the controls on one tab, copying them and
pasting copies on each new tab. In VB 6 this would have given me control
arrays of each box, with the index numbers corresponding to the tabpage
index number (first tab having index 0, second index 1 etc.). This would
make sure I only needed 1 very simple procedure to write the HTML:

Sub Button1_Click(index as Integer.... etc.)
Open test.html For Output As #1
Write(1, textbox1(index).text)
Write(1, textbox2(index).text)
If Checkbox1(index).Checked Then
Write(1,SomeHTMLCode)
Else
Write(1,OtherHTML Code)
End If

etc.
End Sub

I guess you already guessed where the glitch is: control arrays no longer
exist in VB .NET 2003. So basically I'm lost. I don't want to create
tabpage-specific coding, especially because that's gonna make it a hell of a
lot harder to add and remove tab pages with the exact same controls
(something which was extremely easy in VB 6). Plus it's gonna be very ugly
and bulky, as you need n times as much procedures, n being the number of
tabpages... so yeah, I'm pretty much lost.

I read up on some of the articles replacing the control arrays with
collections. Will they do the job? That is, can I use them to write common
handlers using indexes to keep track which control fired up the event and
use the same indexes with the textboxes etc. etc.? If so, how? Any
recommended reading?

Any help much appreciated,

John
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a

"John" <I_*********@microsoft.com> wrote in message
news:eX**************@TK2MSFTNGP15.phx.gbl...
I guess you already guessed where the glitch is: control arrays no longer
exist in VB .NET 2003.


Newsgroup searches are a good thing*. A thread was just recently posted
called "control arrays." Here's a link that was provided in one of the
replies:

http://msdn.microsoft.com/vbasic/usi...et05132003.asp


* http://www.google.com/groups
Nov 21 '05 #2

P: n/a
Jeff,

* "Jeff Johnson [MVP: VB]" <i.***@enough.spam> scripsit:
I guess you already guessed where the glitch is: control arrays no longer
exist in VB .NET 2003.


Newsgroup searches are a good thing*. A thread was just recently posted
called "control arrays." Here's a link that was provided in one of the
replies:

http://msdn.microsoft.com/vbasic/usi...et05132003.asp


Some additional links on this topic I have collected over the time:

Creating Control Arrays in Visual Basic .NET and Visual C# .NET:
<URL:http://msdn.microsoft.com/library/en-us/dv_vstechart/html/vbtchCreatingControlArraysInVisualBasicNETVisualCN ET.asp>

Getting Back Your Visual Basic 6.0 Goodies
<URL:http://msdn.microsoft.com/library/en-us/dnadvnet/html/vbnet05132003.asp>

WinForms Controls--Creating Control Arrays in VB.NET
<URL:http://www.devx.com/vb2themax/Article/19907/>

Control Array
<URL:http://windowsforms.net/default.aspx?tabindex=5&tabid=47&ItemID=16>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.