//for testing only
MessageBox "The selected Row index is : " + app.whatWAStheSelectedIndex.ToString
MessageBox "The number of rows in the run is: "+ window1.ListBox1.RowCount.ToString
//so now let’s remove the rows from the selected Row Index to the end of the available rows.
for i = (window1.ListBox1.RowCount - 1) to (app.whatWAStheSelectedIndex) step -1
Window1.ListBox1.RemoveRowAt(i)
next i
//now let’s take the value that is in the listbox column 4 and make it our new currentdateandtime
app.theCurrentDateAndTime = DateTime.FromString (window1.ListBox1.CellTextAt(window1.ListBox1.SelectedRowIndex, 4))
//for testing only
MessageBox "The new value of current date time is : "+app.theCurrentDateAndTime.ToString
works if I enter static text, but when I try to grab the cell from the column 4 of the row before, it gives me an OutOfBoundsException. I have verified that the row is indeed existing, but nothing I try will make it work.
I’m out of ideas. Does anyone out there see what I have done wrong?
I think the problem is when you call the CellTextAt() method, the row and column parameters are using a zero-based index, so the value should be 3 instead of 4, if you’re looking for column 4.
I have it working now.
First error… the DUMB one, was that I was missing a closing bracket. Yeah I’m blind.
Two when I entered the code, for some reason, I actually found a funny looking character in the code. looked like a piece of exploded lawn furniture. I think I might have accidentally held down option, or control or something.
This is the working code.
var i as integer
var j as integer
var localTheCurrentDateAndTime as DateTime
// ok. Let’s do this again…and SAVE IT, moron.
// so we will need to see the row index selected.
//for testing only
MessageBox "The selected Row index is : " + app.whatWAStheSelectedIndex.ToString
MessageBox "The number of rows in the run is: "+ window1.ListBox1.RowCount.ToString
//so now let’s remove the rows from the selected Row Index to the end of the available rows.
for i = (window1.ListBox1.RowCount - 1) to (app.whatWAStheSelectedIndex) step -1
Window1.ListBox1.RemoveRowAt(i)
next i
//now let’s take the value that is in the listbox column 4 and make it our new currentdateandtime
app.theCurrentDateAndTime = DateTime.FromString (window1.ListBox1.CellTextAt(i, 4))
//for testing only
MessageBox "The new value of current date time is : "+app.theCurrentDateAndTime.ToString