New topic: NOOB question ARRAys
<http://forums.realsoftware.com/viewtopic.php?t=35328> Page 1 of 1 [ 1 post ] Previous topic | Next topic Author Message coryhefner Post subject: NOOB question ARRAysPosted: Tue Sep 07, 2010 2:16 pm Joined: Thu Dec 10, 2009 2:00 pm Posts: 22 Location: new jersey Now I know how to ask this question... Background question information I have a single column listbox, textbox and a push button control in a window. 1) the list box has been pre loaded with some date in each row. 2) The text box allows user to put some data in it. (non descript) 3) the push button is to save the data from the list box and text box to a table in a database. 4) Database has two columns (name and msg) Question 1) How do I take the data from the list box and text box and write to a table, with each row being a new entry into the table? I have tried using an array to store it as an index but only get the first row to write to the table. (see code below) And can not get it to loop properly. 2) Ho do I take the number of rows that have data that are in a list box and us that number to tell the array how much space it is supposed to have. _____ push button action code Dim nameArray(5) as string //make room for 5 elements in the array Dim i as Integer For i = 0 to Listbox1.Listcount -1 nameArray(i) = Listbox1.list(i) // assign a name to each index in the array Savelist2(i) next i = i +1 ______ method (savelist2 code) //savelist2 is has the properity of (index as integer) DIM dr as new DatabaseRecord 'writing to table dr.column("name") =listbox1.cell(listbox1.ListIndex,0) dr.column("msg") =statictext1.text //'test1=database name //table is the table I am writing to test1.InsertRecord "table",dr test1.Commit thanks Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 1 post ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
