I have a table with empty cell in 1st column, how do i delete the row based on the 1st column,
For i = 0 To Table1.NumberOfRows -1
Dim row() As Object = Table1.GetValue(0,i)
Dim name As String = row(0)
If name = "" Then
Table1.RemoveRow(i)
Return
End If
Next
For i = 0 To Table1.NumberOfRows -1
Dim row() As Object = Table1.GetValue(0,i)
Dim name As String = row(0)
If name.Length = 0 Then
Table1.RemoveRow(i)
Return
End If
Next
'Or if there could be spaces in it
For i = 0 To Table1.NumberOfRows -1
Dim row() As Object = Table1.GetValue(0,i)
Dim name As String = row(0)
If name.Trim.Length = 0 Then
Table1.RemoveRow(i)
Return
End If
Next
I would do it like this, removing all rows with an empty value in the first column:
B4X:
For i = Table1.NumberOfRows -1 To 0
Dim name As String = Table1.GetValue(0, i)
If name = "" Then
Table1.RemoveRow(i)
End If
Next
Table1.GetValue(col, row) returns a String and not an array of objects ! Table1.GetValues(row) returns an array of Strings containing the values of all columns in the given row.
I would do it like this, removing all rows with an empty value in the first column:
B4X:
For i = Table1.NumberOfRows -1 To 0
Dim name As String = Table1.GetValue(0, i)
If name = "" Then
Table1.RemoveRow(i)
End If
Next
Table1.GetValue(col, row) returns a String and not an array of objects ! Table1.GetValues(row) returns an array of Strings containing the values of all columns in the given row.