Hi Guys,
I was hesitant on posting this question but I have looked and I thought I found the answer to my question. What I want to do is just copy the contents of a listbox to a database. The code below is copying the correct amount of rows but with the information in the first row of the listbox. I thought this code “MultiPointWindow.Listbox1.ScrollPosition = LocRow” will move me to the next row. What do you think I am doing wrong? Thanks in advance.
var rs as RowSet
Var sql as string
Var Act as string
Act = "x"
sql = "select * from TestRecord Where customer = ? "
rs = app.db.SelectSQL(sql,vName1)
if rs.RowCount = 0 then
var TestRecord as new DatabaseRow
TestRecord.Column("Customer").StringValue = NameTextField.value
TestRecord.Column("Address").StringValue = AddressTextField.value
TestRecord.Column("Type").StringValue = FreqPopupMenu.text
TestRecord.Column("CityStateZip").StringValue = CityTextField.value
//VAr to see how many rows
Var vRowkount as Integer
Var vRowkount1 as Integer
Var vColKount as Integer
Dim LocRow As Integer
vRowkount1 = 0
vColKount = MultiPointWindow.Listbox1.ColumnCount-7
vRowkount = MultiPointWindow.Listbox1.RowCount
LocRow = 1
while vRowkount <> 0
TestRecord.Column("ScaleID").StringValue = MultiPointWindow.ListBox1.CellValueAt(vRowkount1, 0)
TestRecord.Column("Location").StringValue = MultiPointWindow.ListBox1.CellValueAt(vRowkount1, 1)
TestRecord.Column("Model").StringValue = MultiPointWindow.ListBox1.CellValueAt(vRowkount1, 2)
TestRecord.Column("Serial").StringValue = MultiPointWindow.ListBox1.CellValueAt(vRowkount1, 3)
TestRecord.Column("MFG").StringValue = MultiPointWindow.ListBox1.CellValueAt(vRowkount1, 4)
TestRecord.Column("Cap").StringValue = MultiPointWindow.ListBox1.CellValueAt(vRowkount1, 5)
TestRecord.Column("Res").StringValue = MultiPointWindow.ListBox1.CellValueAt(vRowkount1, 6)
while vColKount <> 0
TestRecord.Column("Test" + str(vColKount)).StringValue = MultiPointWindow.ListBox1.CellValueAt(vRowkount1, vColKount+6 )
vColKount = vColKount - 1
wend
try
app.db.AddRow("TestRecord", TestRecord)
Catch e as DatabaseException
MessageBox e.Message
end try
LocRow = LocRow+1
MultiPointWindow.Listbox1.ScrollPosition = LocRow
vRowkount1 = vRowkount1+1
vRowkount = vRowkount-1
wend
end if