Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
frmFind.vb
Package: Notepad.rar [view]
Upload User: wuanfu007
Upload Date: 2021-01-16
Package Size: 501k
Code Size: 6k
Category:
.net
Development Platform:
DOS
- Public Class frmFind
- Inherits System.Windows.Forms.Form
- Dim selPosition As Integer = 1
- #Region " Windows Form Designer generated code "
- Public Sub New()
- MyBase.New()
- 'This call is required by the Windows Form Designer.
- InitializeComponent()
- 'Add any initialization after the InitializeComponent() call
- End Sub
- 'Form overrides dispose to clean up the component list.
- Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
- If disposing Then
- If Not (components Is Nothing) Then
- components.Dispose()
- End If
- End If
- MyBase.Dispose(disposing)
- End Sub
- 'Required by the Windows Form Designer
- Private components As System.ComponentModel.IContainer
- 'NOTE: The following procedure is required by the Windows Form Designer
- 'It can be modified using the Windows Form Designer.
- 'Do not modify it using the code editor.
- Friend WithEvents Label1 As System.Windows.Forms.Label
- Friend WithEvents txtFindString As System.Windows.Forms.TextBox
- Friend WithEvents cmdFind As System.Windows.Forms.Button
- Friend WithEvents cmdCancel As System.Windows.Forms.Button
- Friend WithEvents chxMatchCase As System.Windows.Forms.CheckBox
- <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
- Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmFind))
- Me.Label1 = New System.Windows.Forms.Label
- Me.txtFindString = New System.Windows.Forms.TextBox
- Me.cmdFind = New System.Windows.Forms.Button
- Me.cmdCancel = New System.Windows.Forms.Button
- Me.chxMatchCase = New System.Windows.Forms.CheckBox
- Me.SuspendLayout()
- '
- 'Label1
- '
- Me.Label1.AutoSize = True
- Me.Label1.Location = New System.Drawing.Point(19, 17)
- Me.Label1.Name = "Label1"
- Me.Label1.Size = New System.Drawing.Size(59, 12)
- Me.Label1.TabIndex = 0
- Me.Label1.Text = "查找内容:"
- '
- 'txtFindString
- '
- Me.txtFindString.Location = New System.Drawing.Point(106, 9)
- Me.txtFindString.Name = "txtFindString"
- Me.txtFindString.Size = New System.Drawing.Size(201, 21)
- Me.txtFindString.TabIndex = 1
- '
- 'cmdFind
- '
- Me.cmdFind.Location = New System.Drawing.Point(55, 57)
- Me.cmdFind.Name = "cmdFind"
- Me.cmdFind.Size = New System.Drawing.Size(90, 24)
- Me.cmdFind.TabIndex = 2
- Me.cmdFind.Text = "查找下一个"
- '
- 'cmdCancel
- '
- Me.cmdCancel.Location = New System.Drawing.Point(217, 57)
- Me.cmdCancel.Name = "cmdCancel"
- Me.cmdCancel.Size = New System.Drawing.Size(90, 25)
- Me.cmdCancel.TabIndex = 3
- Me.cmdCancel.Text = "取消"
- '
- 'chxMatchCase
- '
- Me.chxMatchCase.AutoSize = True
- Me.chxMatchCase.Location = New System.Drawing.Point(322, 12)
- Me.chxMatchCase.Name = "chxMatchCase"
- Me.chxMatchCase.Size = New System.Drawing.Size(84, 16)
- Me.chxMatchCase.TabIndex = 5
- Me.chxMatchCase.Text = "区分大小写"
- '
- 'frmFind
- '
- Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
- Me.ClientSize = New System.Drawing.Size(421, 105)
- Me.Controls.Add(Me.chxMatchCase)
- Me.Controls.Add(Me.cmdCancel)
- Me.Controls.Add(Me.cmdFind)
- Me.Controls.Add(Me.txtFindString)
- Me.Controls.Add(Me.Label1)
- Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
- Me.MaximizeBox = False
- Me.MinimizeBox = False
- Me.Name = "frmFind"
- Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
- Me.Text = "查找与替换"
- Me.ResumeLayout(False)
- Me.PerformLayout()
- End Sub
- #End Region
- Private Sub cmdFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdFind.Click
- Dim srchMode As Microsoft.VisualBasic.CompareMethod
- If chxMatchCase.Checked Then
- srchMode = CompareMethod.Binary
- Else : srchMode = CompareMethod.Text
- End If
- selPosition = InStr(selPosition, FrmMainObj.rtbEditor.Text, txtFindString.Text, srchMode)
- If selPosition = 0 Then
- MsgBox("未找到所查找的内容!")
- Exit Sub
- End If
- FrmMainObj.rtbEditor.Select(selPosition - 1, txtFindString.Text.Length)
- FrmMainObj.rtbEditor.ScrollToCaret()
- Me.TopMost = True
- FrmMainObj.rtbEditor.Focus()
- If selPosition = 0 Then
- selPosition = 1
- Else
- selPosition = selPosition + txtFindString.Text.Length
- End If
- End Sub
- Private Sub cmdCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCancel.Click
- Me.Close()
- End Sub
- ' Private Sub BtnReplace_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnReplace.Click
- '
- ' FrmMainObj.rtbEditor.SelectedText = Replace(FrmMainObj.rtbEditor.Text, FrmMainObj.rtbEditor.SelectedText, Me.TxtReplace.Text)
- ' If selPosition = 1 Then
- ' cmdFind_Click(sender, e)
- ' FrmMainObj.rtbEditor.Text = FrmMainObj.rtbEditor.Text.Remove(selPosition, txtFindString.Text.Length)
- ' FrmMainObj.rtbEditor.Text = FrmMainObj.rtbEditor.Text.Insert(selPosition, TxtReplace.Text)
- ' Else
- ' If selPosition <> 0 Then
- ' FrmMainObj.rtbEditor.Text = FrmMainObj.rtbEditor.Text.Remove(selPosition - 1, txtFindString.Text.Length)
- ' ' FrmMainObj.rtbEditor.Text = FrmMainObj.rtbEditor.Text.Insert(selPosition - 1, TxtReplace.Text)
- ' cmdFind_Click(sender, e)
- ' End If
- ' End If
- 'Else
- ' FrmMainObj.rtbEditor.Text = FrmMainObj.rtbEditor.Text.Insert(selPosition, TxtReplace.Text)
- ' End If
- ' End Sub
- ' Private Sub BtnReplaceAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnReplaceAll.Click
- ' Do
- ' cmdFind_Click(sender, e)
- ' BtnReplace_Click(sender, e)
- ' Loop Until selPosition = 0
- ' End Sub
- End Class