
加好友 发短信
等级:四尾狐
帖子:948
积分:7861
威望:0
精华:0
注册:2013/7/7 13:37:00
|
[求助]自定义窗体点关闭时如何关闭程序 Post By:2013/12/27 15:29:00 [显示全部帖子]
自定义窗体点关闭时如何关闭程序
全局代码
Public DataStr As String = "" Public ButtonYes As Boolean = False
Public Class FormData Inherits System.Windows.Forms.Form
Private Sub ButtonOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonOK.Click '确定 If ComboBoxData.Text.Trim.Length < 1 Then Messagebox.Show("请选择使用账套!","账套选择",MessageBoxButtons.OK,MessageBoxIcon.Information) Return End If DataStr = ComboBoxData.Text ButtonYes = True Me.Close() End Sub
Private Sub FormData_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Me.ComboBoxData = New System.Windows.Forms.ComboBox Me.Label1 = New System.Windows.Forms.Label Me.ButtonOK = New System.Windows.Forms.Button Me.SuspendLayout() ' 'ComboBoxData ' Me.ComboBoxData.FormattingEnabled = True Me.ComboBoxData.Location = New System.Drawing.Point(85, 27) Me.ComboBoxData.Name = "ComboBoxData" Me.ComboBoxData.Size = New System.Drawing.Size(156, 20) Me.ComboBoxData.TabIndex = 0 ' 'Label1 ' Me.Label1.AutoSize = True Me.Label1.Location = New System.Drawing.Point(12, 30) Me.Label1.Name = "Label1" Me.Label1.Size = New System.Drawing.Size(65, 12) Me.Label1.TabIndex = 1 Me.Label1.Text = "可选账套:" ' 'ButtonOK ' Me.ButtonOK.Font = New System.Drawing.Font("宋体", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(134, Byte)) Me.ButtonOK.Location = New System.Drawing.Point(154, 80) Me.ButtonOK.Name = "ButtonOK" Me.ButtonOK.Size = New System.Drawing.Size(87, 29) Me.ButtonOK.TabIndex = 2 Me.ButtonOK.Text = "确定" Me.ButtonOK.UseVisualStyleBackColor = True ' 'FormData ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(253, 121) Me.Controls.Add(Me.ButtonOK) Me.Controls.Add(Me.Label1) Me.Controls.Add(Me.ComboBoxData) Me.MaximizeBox = False Me.MinimizeBox = False Me.Name = "FormData" Me.Text = "请选择帐套" Me.ResumeLayout(False) Me.PerformLayout()
End Sub Friend WithEvents ComboBoxData As System.Windows.Forms.ComboBox Friend WithEvents Label1 As System.Windows.Forms.Label Friend WithEvents ButtonOK As System.Windows.Forms.Button
End Class
Dim frm As New FormData frm.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen frm.TopMost = True '或 e.HideSplashForm = True frm.ShowDialog() '模式打开
If ButtonYes Then '你的策略 msgbox(DataStr) End If
|
|