incrementing through variables and text boxes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Charles E. Vopicka

    incrementing through variables and text boxes

    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,sec ondarray,thirda rray}

    for a = 0 to 2

    arraynames(a)(a rray 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. :-)
  • Cor Ligthert

    #2
    Re: incrementing through variables and text boxes

    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



    Comment

    • Charles E. Vopicka

      #3
      Re: incrementing through variables and text boxes

      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

      Comment

      • Cor Ligthert

        #4
        Re: incrementing through variables and text boxes

        Charles,

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

        Private cma As CurrencyManager
        cma = Directcast(Bind ingContext(data set1.Tables(0)) , CurrencyManager )
        textbox1.DataBi ndings.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.endcurrente dit

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

        I hope this helps for those questions?

        Cor
        [color=blue]
        > 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[/color]


        Comment

        Working...