Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.BooksTableAdapter.Fill(Me.DataDataSet.Books)
Me.DataGridView1.AutoGenerateColumns = False
KeyboardArabic()
End Sub
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
Me.DataGridView1.DataSource = Nothing
Me.Texts_books.Clear()
If Me.TextBox1.Text.Trim.Equals(String.Empty) Then Return
Dim q = Me.DataDataSet.Books.Where(Function(x) RemoveTextTashkeel(x.Texts_books).Contains(RemoveTextTashkeel(Me.TextBox1.Text.Trim)))
If q.Count > 0 Then
Me.DataGridView1.DataSource = q.CopyToDataTable
Me.DataGridView1.ClearSelection()
Me.Texts_books.Clear()
End If
End Sub
Private Sub DataGridView1_SelectionChanged(sender As Object, e As EventArgs) Handles DataGridView1.SelectionChanged
Me.Texts_books.Text = Me.DataGridView1.CurrentRow.Cells(1).Value
End Sub
End Class
كود :
Module Module1
Public Sub KeyboardArabic()
InputLanguage.CurrentInputLanguage = InputLanguage.InstalledInputLanguages.Cast(Of InputLanguage). Where(Function(x) x.Culture.Name.StartsWith("ar")). FirstOrDefault()
End Sub
Public Function RemoveTextTashkeel(txt As String) As String
txt = String.Concat(txt.Split(Enumerable.Range(1611, 8).Select(Function(x) ChrW(x)).ToArray))
txt = System.Text.RegularExpressions.Regex.Replace(txt, "[اأإآ]", "ا")
txt = System.Text.RegularExpressions.Regex.Replace(txt, "[ؤو]", "و")
txt = System.Text.RegularExpressions.Regex.Replace(txt, "[ةه]", "ه")
txt = System.Text.RegularExpressions.Regex.Replace(txt, "[يئى]", "ى")
Return txt
End Function
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.BooksTableAdapter.Fill(Me.DataDataSet.Books)
Me.DataGridView1.AutoGenerateColumns = False
KeyboardArabic()
End Sub
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
Me.DataGridView1.DataSource = Nothing
Me.Texts_books.Clear()
If Me.TextBox1.Text.Trim.Equals(String.Empty) Then Return
Dim q = Me.DataDataSet.Books.Where(Function(x) RemoveTextTashkeel(x.Texts_books).Contains(RemoveTextTashkeel(Me.TextBox1.Text.Trim)))
If q.Count > 0 Then
Me.DataGridView1.DataSource = q.CopyToDataTable
Me.DataGridView1.ClearSelection()
Me.Texts_books.Clear()
End If
End Sub
Private Sub DataGridView1_SelectionChanged(sender As Object, e As EventArgs) Handles DataGridView1.SelectionChanged
Me.Texts_books.Text = Me.DataGridView1.CurrentRow.Cells(1).Value
End Sub
End Class
كود :
Module Module1
Public Sub KeyboardArabic()
InputLanguage.CurrentInputLanguage = InputLanguage.InstalledInputLanguages.Cast(Of InputLanguage). Where(Function(x) x.Culture.Name.StartsWith("ar")). FirstOrDefault()
End Sub
Public Function RemoveTextTashkeel(txt As String) As String
txt = String.Concat(txt.Split(Enumerable.Range(1611, 8).Select(Function(x) ChrW(x)).ToArray))
txt = System.Text.RegularExpressions.Regex.Replace(txt, "[اأإآ]", "ا")
txt = System.Text.RegularExpressions.Regex.Replace(txt, "[ؤو]", "و")
txt = System.Text.RegularExpressions.Regex.Replace(txt, "[ةه]", "ه")
txt = System.Text.RegularExpressions.Regex.Replace(txt, "[يئى]", "ى")
Return txt
End Function
End Module
ممتاز أخي
لكن الكود بحاجة إلى بعض التعديلات
الآن إذا بحثت عن "احمد" بدون همزة
تظهر لي جميع النتائج "احمد" ، "أحمد" ، "آحمد" ، "إحمد"
وهذا هو المطلوب
لكن إذا بحثت عن "أحمد" أو "آحمد" أو "إحمد" لا يعطيني أي نتيجة
فنريد أن نعرف البرنامج أنه عند البحث بتجاهل الهمزات لا فرق بين أ إ آ ا
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.BooksTableAdapter.Fill(Me.DataDataSet.Books)
Me.DataGridView1.AutoGenerateColumns = False
KeyboardArabic()
End Sub
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
Me.DataGridView1.DataSource = Nothing
Me.Texts_books.Clear()
If Me.TextBox1.Text.Trim.Equals(String.Empty) Then Return
Dim q = Me.DataDataSet.Books.Where(Function(x) RemoveTextTashkeel(x.Texts_books).Contains(RemoveTextTashkeel(Me.TextBox1.Text.Trim)))
If q.Count > 0 Then
Me.DataGridView1.DataSource = q.CopyToDataTable
Me.DataGridView1.ClearSelection()
Me.Texts_books.Clear()
End If
End Sub
Private Sub DataGridView1_SelectionChanged(sender As Object, e As EventArgs) Handles DataGridView1.SelectionChanged
Me.Texts_books.Text = Me.DataGridView1.CurrentRow.Cells(1).Value
End Sub
End Class
كود :
Module Module1
Public Sub KeyboardArabic()
InputLanguage.CurrentInputLanguage = InputLanguage.InstalledInputLanguages.Cast(Of InputLanguage). Where(Function(x) x.Culture.Name.StartsWith("ar")). FirstOrDefault()
End Sub
Public Function RemoveTextTashkeel(txt As String) As String
txt = String.Concat(txt.Split(Enumerable.Range(1611, 8).Select(Function(x) ChrW(x)).ToArray))
txt = System.Text.RegularExpressions.Regex.Replace(txt, "[اأإآ]", "ا")
txt = System.Text.RegularExpressions.Regex.Replace(txt, "[ؤو]", "و")
txt = System.Text.RegularExpressions.Regex.Replace(txt, "[ةه]", "ه")
txt = System.Text.RegularExpressions.Regex.Replace(txt, "[يئى]", "ى")
Return txt
End Function
End Module
ممتاز أخي
لكن الكود بحاجة إلى بعض التعديلات
الآن إذا بحثت عن "احمد" بدون همزة
تظهر لي جميع النتائج "احمد" ، "أحمد" ، "آحمد" ، "إحمد"
وهذا هو المطلوب
لكن إذا بحثت عن "أحمد" أو "آحمد" أو "إحمد" لا يعطيني أي نتيجة
فنريد أن نعرف البرنامج أنه عند البحث بتجاهل الهمزات لا فرق بين أ إ آ ا
وجزاك الله خيرا
أخي الكريم
الكود بحاجة إلى بعض التعديلات
يسر الله لك العمل عليه ونفعنا جميعا
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.BooksTableAdapter.Fill(Me.DataDataSet.Books)
Me.DataGridView1.AutoGenerateColumns = False
KeyboardArabic()
End Sub
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
Me.DataGridView1.DataSource = Nothing
Me.Texts_books.Clear()
If Me.TextBox1.Text.Trim.Equals(String.Empty) Then Return
Dim q = Me.DataDataSet.Books.Where(Function(x) RemoveTextTashkeel(x.Texts_books).Contains(RemoveTextTashkeel(Me.TextBox1.Text.Trim)))
If q.Count > 0 Then
Me.DataGridView1.DataSource = q.CopyToDataTable
Me.DataGridView1.ClearSelection()
Me.Texts_books.Clear()
End If
End Sub
Private Sub DataGridView1_SelectionChanged(sender As Object, e As EventArgs) Handles DataGridView1.SelectionChanged
Me.Texts_books.Text = Me.DataGridView1.CurrentRow.Cells(1).Value
End Sub
End Class
كود :
Module Module1
Public Sub KeyboardArabic()
InputLanguage.CurrentInputLanguage = InputLanguage.InstalledInputLanguages.Cast(Of InputLanguage). Where(Function(x) x.Culture.Name.StartsWith("ar")). FirstOrDefault()
End Sub
Public Function RemoveTextTashkeel(txt As String) As String
txt = String.Concat(txt.Split(Enumerable.Range(1611, 8).Select(Function(x) ChrW(x)).ToArray))
txt = System.Text.RegularExpressions.Regex.Replace(txt, "[اأإآ]", "ا")
txt = System.Text.RegularExpressions.Regex.Replace(txt, "[ؤو]", "و")
txt = System.Text.RegularExpressions.Regex.Replace(txt, "[ةه]", "ه")
txt = System.Text.RegularExpressions.Regex.Replace(txt, "[يئى]", "ى")
Return txt
End Function
End Module
ممتاز أخي
لكن الكود بحاجة إلى بعض التعديلات
الآن إذا بحثت عن "احمد" بدون همزة
تظهر لي جميع النتائج "احمد" ، "أحمد" ، "آحمد" ، "إحمد"
وهذا هو المطلوب
لكن إذا بحثت عن "أحمد" أو "آحمد" أو "إحمد" لا يعطيني أي نتيجة
فنريد أن نعرف البرنامج أنه عند البحث بتجاهل الهمزات لا فرق بين أ إ آ ا
وجزاك الله خيرا
أخي الكريم
الكود بحاجة إلى بعض التعديلات
يسر الله لك العمل عليه ونفعنا جميعا