⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lr.frm

📁 关于VB开发的教程
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "6-2"
   ClientHeight    =   2910
   ClientLeft      =   3540
   ClientTop       =   3570
   ClientWidth     =   5190
   LinkTopic       =   "Form1"
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   2910
   ScaleWidth      =   5190
   Begin VB.OptionButton Option3 
      Caption         =   "删除两边空格"
      Height          =   372
      Left            =   1800
      TabIndex        =   5
      Top             =   2160
      Width           =   2295
   End
   Begin VB.OptionButton Option2 
      Caption         =   "删除右边空格"
      Height          =   372
      Left            =   1800
      TabIndex        =   4
      Top             =   1560
      Width           =   2295
   End
   Begin VB.OptionButton Option1 
      Caption         =   "删除左边空格"
      Height          =   372
      Left            =   1800
      TabIndex        =   3
      Top             =   960
      Width           =   2295
   End
   Begin VB.TextBox Text3 
      Height          =   372
      Left            =   3480
      TabIndex        =   2
      Text            =   "Text3"
      Top             =   240
      Width           =   1572
   End
   Begin VB.TextBox Text2 
      Height          =   372
      Left            =   1800
      TabIndex        =   1
      Text            =   "Text2"
      Top             =   240
      Width           =   1452
   End
   Begin VB.TextBox Text1 
      Height          =   372
      Left            =   120
      TabIndex        =   0
      Text            =   "Text1"
      Top             =   240
      Width           =   1452
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim LTrimmedword$, RTrimmedword$ '删除左边空格和右边空格后的字符串
Dim LRTrimmedword$ '删除两边空格后的字符串

Function addstar(tempword As String) As String
Dim charindex%
Dim pasteword$ '加星号后的字符串
For charindex = 1 To Len(tempword)
If Mid(tempword, charindex, 1) = " " Then '如果字符为空格
pasteword = pasteword + "*"
Else: pasteword = pasteword + Mid(tempword, charindex, 1)
End If
Next
addstar = pasteword '返回函数值
End Function

Private Sub Form_Load()

End Sub

Private Sub Option1_Click()
Text3.Text = LTrimmedword '显示删除左空格后的字符串
End Sub

Private Sub Option2_Click()
Text3.Text = RTrimmedword '显示删除右空格后的字符串
End Sub


Private Sub Option3_Click()
Text3.Text = LRTrimmedword '显示删除两边空格后的字符串
End Sub


Private Sub Text1_GotFocus() '但焦点于Text1
'清除所有文本框中的字符
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End Sub

Private Sub Text1_LostFocus()
Dim Origionword As String
Origionword = Text1.Text
Text2.Text = addstar(Origionword)
LTrimmedword = addstar(LTrim(Origionword))
RTrimmedword = addstar(RTrim(Origionword))
LRTrimmedword = LTrim(RTrim(Origionword))
End Sub


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -