میخوام برای کتابم جستجو بنویسم. یه کاری کردم که عنوانی رو در کل دیتابیس جستجو میکنه و رکوردهایی که این عنوان توش هست رو لیست میکنه
میخوام کاری کنم که رکوری رو که پیدا کرد و روش کلیک کردم خودکار نشانگر بره ب متن مورد نظر در رکورد و متن رو هایلایت کنه
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private psearch1 As Panel
Private ssearch As ScrollView
Private Ese As EditText
Private Label1 As Label
Private Bsearch As Button
Private Label2 As Label
Private RadioButton1 As RadioButton
Private RadioButton2 As RadioButton
Private Label3 As Label
Private CheckBox1 As CheckBox
Private btnnumber As Button
Private idt As Button
Private lblfrom As Label
Dim btmp As Bitmap
Private List_Matlab As ListView
Dim meghdar As String
End Sub
Sub Activity_Create(FirstTime As Boolean)
''''''''گذلشتن عکس در ایست ویو''''''
Dim listimg As BitmapDrawable
List_Matlab.Initialize(List_Matlab)
listimg.Initialize(LoadBitmap(File.DirAssets,"buttonnorm.png"))
''''''''''''''''
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("search")
List_Matlab.SingleLineLayout.Label.Gravity = Gravity.CENTER
List_Matlab.SingleLineLayout.Label.TextColor = Colors.Black
Dim cur As Cursor
cur = menu.SQL1.ExecQuery("SELECT * FROM mytable")
For i = 0 To cur.RowCount-1
cur.Position = i
List_Matlab.SingleLineLayout.Label.TextColor=Colors.white
List_Matlab.AddSingleLine2(cur.GetString("list"),cur.GetInt("id"))
List_Matlab.SingleLineLayout.Background=listimg
List_Matlab.SingleLineLayout.Label.TextSize =13
Next
cur.Close
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub List_Matlab_ItemClick (Position As Int, Value As Object)
Matlab_Home.meghdar = Value
StartActivity(Matlab_Home)
End Sub
Sub List_Matlab_ItemLongClick (Position As Int, Value As Object)
Dim cur As Cursor
cur = menu.SQL1.ExecQuery("SELECT * FROM mytable")
cur.Position = Value - 1
Dim fav As Int = cur.GetInt("fav")
If fav = 0 Then
menu.SQL1.ExecNonQuery("UPDATE mytable SET fav = 1 WHERE id = "&cur.GetInt("id"))
ToastMessageShow("به علاقه مندی اضافه شد",False)
Else
menu.SQL1.ExecNonQuery("UPDATE mytable SET fav = 0 WHERE id = "&cur.GetInt("id"))
ToastMessageShow("حذف شد",False)
End If
End Sub
Sub Ese_TextChanged (Old As String, New As String)
' Dim cur As Cursor
' cur = menu.SQL1.ExecQuery("SELECT * FROM mytable WHERE list LIKE '%" & Ese.Text & "%'")
'
Dim cur As Cursor
If RadioButton1.Checked=True Then
cur = menu.SQL1.ExecQuery("SELECT * FROM mytable WHERE list LIKE '%" & Ese.Text & "%'")
End If
If RadioButton2.Checked=True Then
cur = menu.SQL1.ExecQuery("SELECT * FROM mytable WHERE matn LIKE '%" & Ese.Text & "%'")
End If
List_Matlab.Clear
For i = 0 To cur.RowCount-1
cur.Position = i
List_Matlab.AddSingleLine2(cur.GetString("list"),cur.GetInt("id"))
Next
cur.Close
End Sub
سوال
seyed_27 171
بسمه تعالی
با سلام خدمت دوستان
میخوام برای کتابم جستجو بنویسم. یه کاری کردم که عنوانی رو در کل دیتابیس جستجو میکنه و رکوردهایی که این عنوان توش هست رو لیست میکنه
میخوام کاری کنم که رکوری رو که پیدا کرد و روش کلیک کردم خودکار نشانگر بره ب متن مورد نظر در رکورد و متن رو هایلایت کنه
Sub Globals 'These global variables will be redeclared each time the activity is created. 'These variables can only be accessed from this module. Private psearch1 As Panel Private ssearch As ScrollView Private Ese As EditText Private Label1 As Label Private Bsearch As Button Private Label2 As Label Private RadioButton1 As RadioButton Private RadioButton2 As RadioButton Private Label3 As Label Private CheckBox1 As CheckBox Private btnnumber As Button Private idt As Button Private lblfrom As Label Dim btmp As Bitmap Private List_Matlab As ListView Dim meghdar As String End Sub Sub Activity_Create(FirstTime As Boolean) ''''''''گذلشتن عکس در ایست ویو'''''' Dim listimg As BitmapDrawable List_Matlab.Initialize(List_Matlab) listimg.Initialize(LoadBitmap(File.DirAssets,"buttonnorm.png")) '''''''''''''''' 'Do not forget to load the layout file created with the visual designer. For example: Activity.LoadLayout("search") List_Matlab.SingleLineLayout.Label.Gravity = Gravity.CENTER List_Matlab.SingleLineLayout.Label.TextColor = Colors.Black Dim cur As Cursor cur = menu.SQL1.ExecQuery("SELECT * FROM mytable") For i = 0 To cur.RowCount-1 cur.Position = i List_Matlab.SingleLineLayout.Label.TextColor=Colors.white List_Matlab.AddSingleLine2(cur.GetString("list"),cur.GetInt("id")) List_Matlab.SingleLineLayout.Background=listimg List_Matlab.SingleLineLayout.Label.TextSize =13 Next cur.Close End Sub Sub Activity_Resume End Sub Sub Activity_Pause (UserClosed As Boolean) End Sub Sub List_Matlab_ItemClick (Position As Int, Value As Object) Matlab_Home.meghdar = Value StartActivity(Matlab_Home) End Sub Sub List_Matlab_ItemLongClick (Position As Int, Value As Object) Dim cur As Cursor cur = menu.SQL1.ExecQuery("SELECT * FROM mytable") cur.Position = Value - 1 Dim fav As Int = cur.GetInt("fav") If fav = 0 Then menu.SQL1.ExecNonQuery("UPDATE mytable SET fav = 1 WHERE id = "&cur.GetInt("id")) ToastMessageShow("به علاقه مندی اضافه شد",False) Else menu.SQL1.ExecNonQuery("UPDATE mytable SET fav = 0 WHERE id = "&cur.GetInt("id")) ToastMessageShow("حذف شد",False) End If End Sub Sub Ese_TextChanged (Old As String, New As String) ' Dim cur As Cursor ' cur = menu.SQL1.ExecQuery("SELECT * FROM mytable WHERE list LIKE '%" & Ese.Text & "%'") ' Dim cur As Cursor If RadioButton1.Checked=True Then cur = menu.SQL1.ExecQuery("SELECT * FROM mytable WHERE list LIKE '%" & Ese.Text & "%'") End If If RadioButton2.Checked=True Then cur = menu.SQL1.ExecQuery("SELECT * FROM mytable WHERE matn LIKE '%" & Ese.Text & "%'") End If List_Matlab.Clear For i = 0 To cur.RowCount-1 cur.Position = i List_Matlab.AddSingleLine2(cur.GetString("list"),cur.GetInt("id")) Next cur.Close End Subلینک ارسال
به اشتراک گذاری در سایت های دیگر
6 پاسخ به این سوال تاکنون داده شده است
ارسالهای توصیه شده
بایگانی شده
این موضوع بایگانی و قفل شده و دیگر امکان ارسال پاسخ نیست.