Sub DBload
LVDb.Clear'need to clear the list
cursor1 = SQL1.ExecQuery("SELECT * FROM tblUsers")
For i = 0 To cursor1.RowCount - 1
cursor1.Position = i
LVDb.AddSingleLine(cursor1.GetString("ID")& "| " &cursor1.GetString("Username"))
LVDb.SingleLineLayout.ItemHeight = 99
LVDb.SingleLineLayout.Label.TextSize = 20
LVDb.SingleLineLayout.Label.TextColor = Colors.Black
LVDb.SingleLineLayout.Label.Color = Colors.White
Next
End Sub
Sub cmdAdd_Click
If txt1.Text = "" Then
Msgbox("You have to enter the name","Missed data field")
Else
'Grab the last ID number which is the highest number
cursor1 = SQL1.ExecQuery("SELECT ID FROM tblUsers")
If cursor1.RowCount > 0 Then
For i = 0 To cursor1.RowCount - 1
cursor1.Position = i
Dim NewID As Int
NewID = cursor1.GetInt("ID")
Next
End If
NewID = NewID +1 ' add 1 to the ID number to make a new ID field
SQL1.ExecNonQuery("INSERT INTO tblUsers VALUES('" & NewID & "','" & txt1.Text & "','" & txt2.Text & "','" & txt3.Text & "','" & txtPic.Text & "')")
DBload
txt1.Text = ""
txt2.Text = ""
txt3.Text = ""
txtPic.Text = ""
txtPOI.RequestFocus
End If
End Sub
Sub LVDb_ItemClick (Position As Int, Value As Object)' click on the entry in the list
Dim idvalue As String
Dim countIt As Int
Dim vBild As String
idvalue = Value
ImageView1.Bitmap = Null
countIt = idvalue.IndexOf("|") 'find location of sperator
idvalue = idvalue.SubString2(0,countIt) 'find first part of label text
ID = idvalue
cursor1 = SQL1.ExecQuery("SELECT * FROM tblUsers where ID = '" & ID & "' ")
For i = 0 To cursor1.RowCount - 1
cursor1.Position = i
txt1.text=cursor1.getString("Username")
txt2.text=cursor1.getString("Password")
txt3.text=cursor1.getString("Desc")
vBild = cursor1.getString("Pic")
If vBild = "" OR vBild = Null Then
vBild = "0.jpg"
Else
vBild = cursor1.getString("Pic")
End If
ImageView1.Bitmap = LoadBitmapSample(File.DirRootExternal & "/DCIM" & "/100Media", vBild, 10,110)
Next
End Sub