raphipps2002 Active Member Licensed User Longtime User Oct 14, 2015 #1 As vb.net developer am new to B4J...call me a novice I want to create a table with colums and plunged into thinking i should use a listview similar to vb.net. However it seems that this is a single column object So, how do I create a table with columns and rows
As vb.net developer am new to B4J...call me a novice I want to create a table with colums and plunged into thinking i should use a listview similar to vb.net. However it seems that this is a single column object So, how do I create a table with columns and rows
R Roycefer Well-Known Member Licensed User Longtime User Oct 14, 2015 #2 https://www.b4x.com/android/forum/threads/tableview-tutorial.35542/#content Upvote 0
raphipps2002 Active Member Licensed User Longtime User Oct 14, 2015 #3 Ah I see...so successfully added rows to my 5 column table, one by one....I wanted to add up one particular column. But Dim r() As String = tblCB.Items.Get(j) causes a crash. Code: Copy For j = 0 To tblCB.Items.Size-1 Dim r() As String = tblCB.Items.Get(j) BankOut = BankOut + r(2) BankIn = BankIn + r(3) Next What am I doing wrong? Upvote 0
Ah I see...so successfully added rows to my 5 column table, one by one....I wanted to add up one particular column. But Dim r() As String = tblCB.Items.Get(j) causes a crash. Code: Copy For j = 0 To tblCB.Items.Size-1 Dim r() As String = tblCB.Items.Get(j) BankOut = BankOut + r(2) BankIn = BankIn + r(3) Next What am I doing wrong?
Daestrum Expert Licensed User Longtime User Oct 14, 2015 #4 What is the actual error message you are getting ? Upvote 0
R Roycefer Well-Known Member Licensed User Longtime User Oct 14, 2015 #5 What is the stack trace for the crash? There could be any of a number of possible problems. You might be trying to access an empty array element. You might be trying to cast a String to a numerical type and the cast is failing. But this is all just wild speculation without seeing the stack trace. Upvote 0
What is the stack trace for the crash? There could be any of a number of possible problems. You might be trying to access an empty array element. You might be trying to cast a String to a numerical type and the cast is failing. But this is all just wild speculation without seeing the stack trace.
raphipps2002 Active Member Licensed User Longtime User Oct 14, 2015 #6 As I got your message i found this on the, dim r() as object = tb.items.get(j) The object worked not string...thanks anyway Upvote 0
As I got your message i found this on the, dim r() as object = tb.items.get(j) The object worked not string...thanks anyway
Daestrum Expert Licensed User Longtime User Oct 14, 2015 #7 As a tip. if you have 5 columns, create a type variable so you can refer to the columns by name ie. Code: Copy Type datarow (a as object, b as object, bankOut as object, bankIn as object, e as object) then your code becomes Code: Copy ... Dim row As datarow = tblCB.Items.Get(j) BankOut = BankOut + row.bankOut BankIn = BankIn + row.bankIn ... which is easier to read and less prone to adding the wrong column to your totals etc Upvote 0
As a tip. if you have 5 columns, create a type variable so you can refer to the columns by name ie. Code: Copy Type datarow (a as object, b as object, bankOut as object, bankIn as object, e as object) then your code becomes Code: Copy ... Dim row As datarow = tblCB.Items.Get(j) BankOut = BankOut + row.bankOut BankIn = BankIn + row.bankIn ... which is easier to read and less prone to adding the wrong column to your totals etc