vb.net取消按键,退出VB的快捷键

VB2008 如何取消窗体的关闭按钮

设置ControlBox为False是可以的,不过全部按钮都会消失(包括最小化,最大化)

成都创新互联公司专注于隆尧网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供隆尧营销型网站建设,隆尧网站制作、隆尧网页设计、隆尧网站官网定制、微信小程序开发服务,打造隆尧网络公司原创品牌,更为您提供隆尧网站排名全网营销落地服务。

用API可以单独把关闭按钮干掉……

'VB.NET Code

Public Class Form1

Private Declare Function GetSystemMenu Lib "User32 " (ByVal hwnd As Integer, ByVal bRevert As Long) As Integer

Private Declare Function RemoveMenu Lib "User32 " (ByVal hMenu As Integer, ByVal nPosition As Integer, ByVal wFlags As Integer) As Integer

Private Declare Function DrawMenuBar Lib "User32 " (ByVal hwnd As Integer) As Integer

Private Declare Function GetMenuItemCount Lib "User32 " (ByVal hMenu As Integer) As Integer

Private Const MF_BYPOSITION = H400

Private Const MF_DISABLED = H2

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim hMenu As Integer, nCount As Integer

hMenu = GetSystemMenu(Me.Handle.ToInt32, 0)

nCount = GetMenuItemCount(hMenu)

'Debug.Print(nCount)

Call RemoveMenu(hMenu, nCount - 1, MF_DISABLED Or MF_BYPOSITION)

DrawMenuBar(Me.Handle.ToInt32)

End Sub

End Class

'VB6 code =============================================================

Private Declare Function GetSystemMenu Lib "User32 " (ByVal hwnd As Long, ByVal bRevert As Long) As Integer

Private Declare Function RemoveMenu Lib "User32 " (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long

Private Declare Function DrawMenuBar Lib "User32 " (ByVal hwnd As Long) As Long

Private Declare Function GetMenuItemCount Lib "User32 " (ByVal hMenu As Long) As Long

Private Const MF_BYPOSITION = H400

Private Const MF_DISABLED = H2

Private Sub Form1_Load()

Dim hMenu As Long, nCount As Long

hMenu = GetSystemMenu(Me.hWnd, 0)

nCount = GetMenuItemCount(hMenu)

'Debug.Print nCount

Call RemoveMenu(hMenu, nCount - 1, MF_DISABLED Or MF_BYPOSITION)

DrawMenuBar Me.hWnd

End Sub

VB.NET中,右上角的关闭按钮走的什么事件

Private Sub Form2_FormClosed(sender As Object, e As FormClosedEventArgs) Handles Me.FormClosed

End    '退出后关闭软件

End Sub

'点击关闭按钮时弹出对话框判断是否退出

Private Sub Form2_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing

'经典判断关闭法

If MessageBox.Show("是否退出?", "确认", MessageBoxButtons.OKCancel, MessageBoxIcon.Question,

MessageBoxDefaultButton.Button2) = Windows.Forms.DialogResult.Cancel Then

e.Cancel = True

Else

e.Cancel = False

End If

End Sub

vb.net 取消事件

url="script language=javascriptwindow.close();/script";

Response.Write(url);

vb.net 如何用一个按钮(button)来关闭按钮所在的窗体

在该按纽的单击事件编写代码:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Me.Close()

End Sub

在VB6的时候,使用:Unload me

在VB.NET里使用:Me.Close()

VB.net如何判断用户是否按了inputbox对话框的取消按钮?

如果用户单击 Cancel(取消),则InputBox函数返回一个长度为零的字符串 (""),可以根zhidao据这个情况进行判断,如果BH="",则用户按内了“取消容”键,但如果用户把输入的内容清空,这时按“确定”和按“取消”一样,都返回一个长度为的字符串。


新闻标题:vb.net取消按键,退出VB的快捷键
分享URL:http://ybzwz.com/article/hcpgcd.html