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

incrementing through variables and text boxes

P: n/a
i think i already know the answer to the first question but it took me
2 months of searching to find it.

i am writing a program that collects user input then stores the data
in arrays then when tehy are done saves to a comma seperated file.
but i am trying to find a more effecient way of populating the array
from the data file.

say i have 3 arrays and 3 data files i would like to :

arraynames() = {firstarray,secondarray,thirdarray}

for a = 0 to 2

arraynames(a)(array possn) = whatever data

next

so i want to incrementaly move through a known list of arrays and
populate them. sorry i am sure my syntax is terrable. right now i
have to make 3 different loops to populate the 3 arrays. sinc i have
to have one for each array i want to populate. this doesn't just have
to do waith arrays but any variable with known names.

i think the answer to this is keep dreaming but on a somewhat related
topic i have created page with multiple textboxes named something
sequentialy. is there a way to send data back to those text boxes
without having to enter all the textbox.text statements for all the
textboxes.

for example

here is a slight representation of the text boxes

c1r1 c2r1 c3r1
c1r2 c2r2 c3r2
c1r3 c2r3 c3r3

then i want to make some kind of nested loop

for a = 1 to 3 step 1

for b = 1 to 3 step 1

("c" & a & "r" & b).text = "bla bla bla"

next b

next a

thanks for any assistance anyone can offer. i am not a great writer
so i hope i explained things well enough. but i can type better in
code than i can in english i think. :-)
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Charles,

There is nothing wrong with your loop, however did you know that a dataset
is a 3 dimmensional array.

Dataset holds tables which hold rows which hold items. In my idea very
efficient for your problem because it has so many methods you can do almost
everything with that.

Cor

Nov 21 '05 #2

P: n/a
wow thanks. i have been playing with dataset's all morning now. i
always just associated them with databases. i also didn't know that i
could associate the value in a cell to a property of a textbox. i
believe that this will make life easier. it looks like i can stop
using my huge arrays and put my data into a table of a dataset. i
just always think arays since i started (back in the day) with basic
then qbasic and now VB. that will make life easier. i however have
not found an easy way to associate textbox.text with say column 3 row
2 of the dataset. as long as i associate with row 1 (actualy 0 i
think) i can make the connection to any column. but i haven't found
the step for associating with a different row. thanks for all the
help
Nov 21 '05 #3

P: n/a
Charles,

That next step is as well very easy, have a look at databinding and
currencymanger

Private cma As CurrencyManager
cma = Directcast(BindingContext(dataset1.Tables(0)), CurrencyManager)
textbox1.DataBindings.Add(New Binding("Text", dataset1.Tables(0),
"MyField"))

cma.position is the current position

Because the data is set into the dataset after a focus change, do you have
to force that when the focus is on the textbox, because a button change no
focus.

cma.endcurrentedit

(You will probably have that last as question when did not tell it direct)

I hope this helps for those questions?

Cor
wow thanks. i have been playing with dataset's all morning now. i
always just associated them with databases. i also didn't know that i
could associate the value in a cell to a property of a textbox. i
believe that this will make life easier. it looks like i can stop
using my huge arrays and put my data into a table of a dataset. i
just always think arays since i started (back in the day) with basic
then qbasic and now VB. that will make life easier. i however have
not found an easy way to associate textbox.text with say column 3 row
2 of the dataset. as long as i associate with row 1 (actualy 0 i
think) i can make the connection to any column. but i haven't found
the step for associating with a different row. thanks for all the
help

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.