تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
[سؤال] استفسار مهم
#1
ريتش بوكس 1 
تيكست بوكس 1 
بوتن1 
الريتش بوكس فيه كلمه السلام عليكم 
محتاج اعمل بحث عن اي كلمه في الريتش بوكس من خلال التكست بوكس يعني لو كتبت السلام في التكست بوكس 
عند الضغط علي بوتن 1 يتغير لو خلفيه التكست بوكس الي اخضر
الرد }}}
تم الشكر بواسطة: سعود
#2
الشرح هنا وتمت التجربة بنجاح.
اللهم إني أعوذ بك من غلبة الدين وغلبة العدو، اللهم إني أعوذ بك من جهد البلاء ومن درك الشقاء ومن سوء القضاء ومن شماتة الأعداء، اللهم أصلح لي ديني الذي هو عصمة أمري، وأصلح لي دنياي التي فيها معاشي، وأصلح لي آخرتي التي فيها معادي، واجعل الحياة زيادة لي في كل خير، واجعل الموت راحة لي من كل شر
اللهم اغفر لي خطيئتي وجهلي، وإسرافي في أمري وما أنت أعلم به مني، اللهم اغفر لي جدي وهزلي وخطأي وعمدي وكل ذلك عندي، اللهم اغفر لي ما قدمت وما أخرت، وما أسررت وما أعلنت وما أنت أعلم به مني، أنت المقدم وأنت المؤخر وأنت على كل شيء قدير
الرد }}}
تم الشكر بواسطة: bakriano30@yahoo.com , ابراهيم ايبو
#3
(22-07-19, 05:41 PM)سعود كتب : الشرح هنا وتمت التجربة بنجاح.

للاسف اطلعت عليه من قبل اخ سعود ولم افهم الكود اطلاقا حتي استعمله

(22-07-19, 05:41 PM)سعود كتب : الشرح هنا وتمت التجربة بنجاح.

للاسف اطلعت عليه من قبل اخ سعود ولم افهم الكود اطلاقا حتي استعمله
الرد }}}
تم الشكر بواسطة: سعود
#4
موضوع سؤال زي موضوعنا والجواب تحت زي جوابي هذاSmile
PHP كود :
Sub findTextAndHighlight(ByVal searchtext As StringByVal rtb As RichTextBox)
 
   Dim textEnd As Integer rtb.TextLength
    Dim index 
As Integer 0
    Dim fnt 
As Font = New Font(rtb.FontFontStyle.Bold)
 
   Dim lastIndex As Integer rtb.Text.LastIndexOf(searchtext)
 
   While (index lastIndex)
 
     rtb.Find(searchtextindextextEndRichTextBoxFinds.WholeWord)
 
     rtb.SelectionFont fnt
      rtb
.SelectionLength searchtext.Length
      rtb
.SelectionColor Color.Red
      rtb
.SelectionBackColor Color.Cyan
      index 
rtb.Text.IndexOf(searchtextindex) + 1
    End 
While
 
 End Sub

'============USAGE============

 Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
 '
this method with search for text "boy" in RichTextBox2change the textcolor to red and back color to cyan as indicated in the screenshot below 
 findTextAndHighlight
("boy"RichTextBox2  
 End Sub 
اللهم إني أعوذ بك من غلبة الدين وغلبة العدو، اللهم إني أعوذ بك من جهد البلاء ومن درك الشقاء ومن سوء القضاء ومن شماتة الأعداء، اللهم أصلح لي ديني الذي هو عصمة أمري، وأصلح لي دنياي التي فيها معاشي، وأصلح لي آخرتي التي فيها معادي، واجعل الحياة زيادة لي في كل خير، واجعل الموت راحة لي من كل شر
اللهم اغفر لي خطيئتي وجهلي، وإسرافي في أمري وما أنت أعلم به مني، اللهم اغفر لي جدي وهزلي وخطأي وعمدي وكل ذلك عندي، اللهم اغفر لي ما قدمت وما أخرت، وما أسررت وما أعلنت وما أنت أعلم به مني، أنت المقدم وأنت المؤخر وأنت على كل شيء قدير
الرد }}}
تم الشكر بواسطة: bakriano30@yahoo.com , ابراهيم ايبو
#5
(22-07-19, 05:58 PM)سعود كتب : موضوع سؤال زي موضوعنا والجواب تحت زي جوابي هذاSmile
PHP كود :
Sub findTextAndHighlight(ByVal searchtext As StringByVal rtb As RichTextBox)
 
   Dim textEnd As Integer rtb.TextLength
    Dim index 
As Integer 0
    Dim fnt 
As Font = New Font(rtb.FontFontStyle.Bold)
 
   Dim lastIndex As Integer rtb.Text.LastIndexOf(searchtext)
 
   While (index lastIndex)
 
     rtb.Find(searchtextindextextEndRichTextBoxFinds.WholeWord)
 
     rtb.SelectionFont fnt
      rtb
.SelectionLength searchtext.Length
      rtb
.SelectionColor Color.Red
      rtb
.SelectionBackColor Color.Cyan
      index 
rtb.Text.IndexOf(searchtextindex) + 1
    End 
While
 
 End Sub

'============USAGE============

 Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
 '
this method with search for text "boy" in RichTextBox2change the textcolor to red and back color to cyan as indicated in the screenshot below 
 findTextAndHighlight
("boy"RichTextBox2  
 End Sub 
الجواب من ايدك يحلي اخ سعود

(22-07-19, 05:58 PM)سعود كتب : موضوع سؤال زي موضوعنا والجواب تحت زي جوابي هذاSmile
PHP كود :
Sub findTextAndHighlight(ByVal searchtext As StringByVal rtb As RichTextBox)
 
   Dim textEnd As Integer rtb.TextLength
    Dim index 
As Integer 0
    Dim fnt 
As Font = New Font(rtb.FontFontStyle.Bold)
 
   Dim lastIndex As Integer rtb.Text.LastIndexOf(searchtext)
 
   While (index lastIndex)
 
     rtb.Find(searchtextindextextEndRichTextBoxFinds.WholeWord)
 
     rtb.SelectionFont fnt
      rtb
.SelectionLength searchtext.Length
      rtb
.SelectionColor Color.Red
      rtb
.SelectionBackColor Color.Cyan
      index 
rtb.Text.IndexOf(searchtextindex) + 1
    End 
While
 
 End Sub

'============USAGE============

 Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
 '
this method with search for text "boy" in RichTextBox2change the textcolor to red and back color to cyan as indicated in the screenshot below 
 findTextAndHighlight
("boy"RichTextBox2  
 End Sub 
كذالك الاخطاء تستمر من فضلك مثال بسيط اخ سعود  انا اسف لتعبك
الرد }}}
تم الشكر بواسطة: ابراهيم ايبو , سعود
#6
(22-07-19, 06:16 PM)bakriano30@yahoo.com كتب :
(22-07-19, 05:58 PM)سعود كتب : موضوع سؤال زي موضوعنا والجواب تحت زي جوابي هذاSmile
PHP كود :
Sub findTextAndHighlight(ByVal searchtext As StringByVal rtb As RichTextBox)
 
   Dim textEnd As Integer rtb.TextLength
    Dim index 
As Integer 0
    Dim fnt 
As Font = New Font(rtb.FontFontStyle.Bold)
 
   Dim lastIndex As Integer rtb.Text.LastIndexOf(searchtext)
 
   While (index lastIndex)
 
     rtb.Find(searchtextindextextEndRichTextBoxFinds.WholeWord)
 
     rtb.SelectionFont fnt
      rtb
.SelectionLength searchtext.Length
      rtb
.SelectionColor Color.Red
      rtb
.SelectionBackColor Color.Cyan
      index 
rtb.Text.IndexOf(searchtextindex) + 1
    End 
While
 
 End Sub

'============USAGE============

 Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
 '
this method with search for text "boy" in RichTextBox2change the textcolor to red and back color to cyan as indicated in the screenshot below 
 findTextAndHighlight
("boy"RichTextBox2  
 End Sub 
الجواب من ايدك يحلي اخ سعود

(22-07-19, 05:58 PM)سعود كتب : موضوع سؤال زي موضوعنا والجواب تحت زي جوابي هذاSmile
PHP كود :
Sub findTextAndHighlight(ByVal searchtext As StringByVal rtb As RichTextBox)
 
   Dim textEnd As Integer rtb.TextLength
    Dim index 
As Integer 0
    Dim fnt 
As Font = New Font(rtb.FontFontStyle.Bold)
 
   Dim lastIndex As Integer rtb.Text.LastIndexOf(searchtext)
 
   While (index lastIndex)
 
     rtb.Find(searchtextindextextEndRichTextBoxFinds.WholeWord)
 
     rtb.SelectionFont fnt
      rtb
.SelectionLength searchtext.Length
      rtb
.SelectionColor Color.Red
      rtb
.SelectionBackColor Color.Cyan
      index 
rtb.Text.IndexOf(searchtextindex) + 1
    End 
While
 
 End Sub

'============USAGE============

 Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
 '
this method with search for text "boy" in RichTextBox2change the textcolor to red and back color to cyan as indicated in the screenshot below 
 findTextAndHighlight
("boy"RichTextBox2  
 End Sub 
كذالك الاخطاء تستمر من فضلك مثال بسيط اخ سعود  انا اسف لتعبك

تفضل اخ كريم
PHP كود :
Dim txt As String
        txt 
RichTextBox1.Find(TextBox1.Text)
 
       RichTextBox1.SelectionBackColor Color.Red 
Basil Abdallah 

الرد }}}
#7
(22-07-19, 06:34 PM)Basil Abdallah كتب :
(22-07-19, 06:16 PM)bakriano30@yahoo.com كتب :
(22-07-19, 05:58 PM)سعود كتب : موضوع سؤال زي موضوعنا والجواب تحت زي جوابي هذاSmile
PHP كود :
Sub findTextAndHighlight(ByVal searchtext As StringByVal rtb As RichTextBox)
 
   Dim textEnd As Integer rtb.TextLength
    Dim index 
As Integer 0
    Dim fnt 
As Font = New Font(rtb.FontFontStyle.Bold)
 
   Dim lastIndex As Integer rtb.Text.LastIndexOf(searchtext)
 
   While (index lastIndex)
 
     rtb.Find(searchtextindextextEndRichTextBoxFinds.WholeWord)
 
     rtb.SelectionFont fnt
      rtb
.SelectionLength searchtext.Length
      rtb
.SelectionColor Color.Red
      rtb
.SelectionBackColor Color.Cyan
      index 
rtb.Text.IndexOf(searchtextindex) + 1
    End 
While
 
 End Sub

'============USAGE============

 Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
 '
this method with search for text "boy" in RichTextBox2change the textcolor to red and back color to cyan as indicated in the screenshot below 
 findTextAndHighlight
("boy"RichTextBox2  
 End Sub 
الجواب من ايدك يحلي اخ سعود

(22-07-19, 05:58 PM)سعود كتب : موضوع سؤال زي موضوعنا والجواب تحت زي جوابي هذاSmile
PHP كود :
Sub findTextAndHighlight(ByVal searchtext As StringByVal rtb As RichTextBox)
 
   Dim textEnd As Integer rtb.TextLength
    Dim index 
As Integer 0
    Dim fnt 
As Font = New Font(rtb.FontFontStyle.Bold)
 
   Dim lastIndex As Integer rtb.Text.LastIndexOf(searchtext)
 
   While (index lastIndex)
 
     rtb.Find(searchtextindextextEndRichTextBoxFinds.WholeWord)
 
     rtb.SelectionFont fnt
      rtb
.SelectionLength searchtext.Length
      rtb
.SelectionColor Color.Red
      rtb
.SelectionBackColor Color.Cyan
      index 
rtb.Text.IndexOf(searchtextindex) + 1
    End 
While
 
 End Sub

'============USAGE============

 Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
 '
this method with search for text "boy" in RichTextBox2change the textcolor to red and back color to cyan as indicated in the screenshot below 
 findTextAndHighlight
("boy"RichTextBox2  
 End Sub 
كذالك الاخطاء تستمر من فضلك مثال بسيط اخ سعود  انا اسف لتعبك

تفضل اخ كريم
PHP كود :
Dim txt As String
        txt 
RichTextBox1.Find(TextBox1.Text)
 
       RichTextBox1.SelectionBackColor Color.Red 

بارك الله فيك هذا هو المطلوب
الرد }}}
تم الشكر بواسطة: asemshahen5 , ابراهيم ايبو , سعود
#8
بعد اذن جيمع الزملاء بارك الله فيهم ... اعتقد ان هذا الكود اسهم و اوضح ومختصر ايضا 
 
كود :
For Each x As Match In Regex.Matches(RichTextBox1.Text, TextBox1.Text)
            RichTextBox1.Select(x.Index, x.Length)
            RichTextBox1.SelectionBackColor = Color.Yellow
        Next
الرد }}}
تم الشكر بواسطة: asemshahen5 , سعود , سعود , ابو روضة
#9

بارك الله فيكم جميعا وشكر لكم.
كيف ممكن نعدل بحيث لو انقصنا  من طول النص يتم الغاء ماكان مظلل بنتيجة البحث السابقة؟!
اللهم إني أعوذ بك من غلبة الدين وغلبة العدو، اللهم إني أعوذ بك من جهد البلاء ومن درك الشقاء ومن سوء القضاء ومن شماتة الأعداء، اللهم أصلح لي ديني الذي هو عصمة أمري، وأصلح لي دنياي التي فيها معاشي، وأصلح لي آخرتي التي فيها معادي، واجعل الحياة زيادة لي في كل خير، واجعل الموت راحة لي من كل شر
اللهم اغفر لي خطيئتي وجهلي، وإسرافي في أمري وما أنت أعلم به مني، اللهم اغفر لي جدي وهزلي وخطأي وعمدي وكل ذلك عندي، اللهم اغفر لي ما قدمت وما أخرت، وما أسررت وما أعلنت وما أنت أعلم به مني، أنت المقدم وأنت المؤخر وأنت على كل شيء قدير
الرد }}}
تم الشكر بواسطة: Basil Abdallah , asemshahen5
#10
بهذه الطريقة

كود :
        RichTextBox1.SelectAll()
        RichTextBox1.SelectionBackColor = Color.White
        For Each x As Match In Regex.Matches(RichTextBox1.Text, TextBox1.Text)
            RichTextBox1.Select(x.Index, x.Length)
            RichTextBox1.SelectionBackColor = Color.Yellow
        Next
الرد }}}
تم الشكر بواسطة: سعود , Basil Abdallah , asemshahen5 , ابراهيم ايبو



التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم