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

📄 form1.vb

📁 Mastering VBNet Include Source Code
💻 VB
字号:
Public Class Form1
    Inherits System.Windows.Forms.Form

#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
    Friend WithEvents bttnConvert As System.Windows.Forms.Button
    Friend WithEvents txtString As System.Windows.Forms.TextBox
    Friend WithEvents txtNumber As System.Windows.Forms.TextBox
    Friend WithEvents Button1 As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.Container

    '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.
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.txtNumber = New System.Windows.Forms.TextBox()
        Me.Button1 = New System.Windows.Forms.Button()
        Me.txtString = New System.Windows.Forms.TextBox()
        Me.bttnConvert = New System.Windows.Forms.Button()
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog()
        Me.SuspendLayout()
        '
        'txtNumber
        '
        Me.txtNumber.Font = New System.Drawing.Font("Verdana", 9!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtNumber.Location = New System.Drawing.Point(144, 8)
        Me.txtNumber.Name = "txtNumber"
        Me.txtNumber.Size = New System.Drawing.Size(152, 22)
        Me.txtNumber.TabIndex = 1
        Me.txtNumber.Text = ""
        '
        'Button1
        '
        Me.Button1.Font = New System.Drawing.Font("Verdana", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Button1.Location = New System.Drawing.Point(8, 160)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(160, 23)
        Me.Button1.TabIndex = 0
        Me.Button1.Text = "Parse Path Name"
        '
        'txtString
        '
        Me.txtString.Font = New System.Drawing.Font("Verdana", 9!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtString.Location = New System.Drawing.Point(8, 40)
        Me.txtString.Multiline = True
        Me.txtString.Name = "txtString"
        Me.txtString.Size = New System.Drawing.Size(288, 104)
        Me.txtString.TabIndex = 2
        Me.txtString.Text = ""
        '
        'bttnConvert
        '
        Me.bttnConvert.Font = New System.Drawing.Font("Verdana", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.bttnConvert.Location = New System.Drawing.Point(8, 8)
        Me.bttnConvert.Name = "bttnConvert"
        Me.bttnConvert.Size = New System.Drawing.Size(120, 23)
        Me.bttnConvert.TabIndex = 0
        Me.bttnConvert.Text = "Convert"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(304, 189)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1, Me.txtString, Me.txtNumber, Me.bttnConvert})
        Me.Name = "Form1"
        Me.Text = "StringTools Test"
        Me.ResumeLayout(False)

    End Sub

#End Region

    Dim ST As New StringTools()
    Private Sub bttnConvert_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bttnConvert.Click
        ST.UseCase = StringTools.clsToolsCase.clsToolsCaps
        ST.UseDelimiter = StringTools.clsToolsDelimit.clsToolsNone
        ST.UsePadding = StringTools.clsToolsPadding.clsToolsCommas
        txtString.Text = ST.Num2String(txtNumber.Text)
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        openFileDialog1.ShowDialog()
        MsgBox("The path is " & ST.ExtractPathName(OpenFileDialog1.FileName) & vbCrLf & _
        "The file name is " & ST.ExtractFileName(OpenFileDialog1.FileName))
    End Sub
End Class

⌨️ 快捷键说明

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