Imports DevComponents.DotNetBar Imports DevComponents.DotNetBar.Office2007Form Public Class frmSearch Private Index As Int32 Friend Rtb As RichTextBox Private Sub btnFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) If chkCase.Checked Then Index = Rtb.Find(txtToSearch.Text, RichTextBoxFinds.MatchCase) Else Index = Rtb.Find(txtToSearch.Text, RichTextBoxFinds.None) 'search If Index = -1 Then 'check if the value has been found Index = 0 'reset the index MessageboxEx.Show("Text not found.", "Search", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Else Rtb.Focus() Index += txtToSearch.TextLength 'move the cursor End If End Sub Private Sub btnFindNext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) If chkCase.Checked Then Index = Rtb.Find(txtToSearch.Text, Index, RichTextBoxFinds.MatchCase) Else : Index = Rtb.Find(txtToSearch.Text, Index, RichTextBoxFinds.None) End If If Index = -1 Then 'check if the value has been found Index = 0 'reset the index MessageBoxEx.Show("Text not found.", "Search", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) Else Rtb.Focus() Index += txtToSearch.TextLength 'move the cursor End If End Sub Private Sub frmSearch_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load MessageBoxEx.MessageBoxTextColor = Color.White MessageBoxEx.EnableGlass = False If CBool(My.Settings.LogFormat64) = False Then Me.TitleText = "Ihabbox - Search (Trial Version)" End If End Sub Private Sub ButtonX1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFind.Click If chkCase.Checked Then Index = Rtb.Find(txtToSearch.Text, RichTextBoxFinds.MatchCase) Else Index = Rtb.Find(txtToSearch.Text, RichTextBoxFinds.None) 'search If Index = -1 Then 'check if the value has been found Index = 0 'reset the index Me.TopMost = False frmPackets.TopMost = False MessageBoxEx.Show("Text not found.", "Search", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) frmPackets.TopMost = True Me.TopMost = True Else Rtb.Focus() Index += txtToSearch.TextLength 'move the cursor End If End Sub Private Sub ButtonX1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFindNext.Click If chkCase.Checked Then Index = Rtb.Find(txtToSearch.Text, Index, RichTextBoxFinds.MatchCase) Else : Index = Rtb.Find(txtToSearch.Text, Index, RichTextBoxFinds.None) End If If Index = -1 Then 'check if the value has been found Index = 0 'reset the index Me.TopMost = False frmPackets.TopMost = False MessageBoxEx.Show("Text not found.", "Search", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) frmPackets.TopMost = True Me.TopMost = True Else Rtb.Focus() Index += txtToSearch.TextLength 'move the cursor End If End Sub End Class