vb.net弹出信息 vbnet doevent
VB.net怎么弹出如下类似的对话框(看图)?
可以利用msgbox 实现,也可以通过另外的窗体上画出表格实现
创新互联建站专业提供西信服务器托管服务,为用户提供五星数据中心、电信、双线接入解决方案,用户可自行在线购买西信服务器托管服务,并享受7*24小时金牌售后服务。
方法一,利用msgbox:
Private Sub Command1_Click()Dim a As Long, b As Long, c As LongMsgBox "┌────┬────┬────┐" vbCrLf _ "│ 库存1 │ 库存2 │ 库存3 │" vbCrLf _ "├────┼────┼────┤" vbCrLf _ "│" formatstr(a) "│" formatstr(b) "│" formatstr(c) "│" vbCrLf _ "└────┴────┴────┘" End SubPrivate Function formatstr(ByVal inputStr As String) As StringDim j As Integerj = (8 - Len(inputStr)) \ 2formatstr = Space(j) inputStr Space(j) Space((8 - Len(inputStr)) Mod 2)End Function
方法二,利用窗体实现:
’新建form2窗体‘将以下代码复制到form2窗体中Private Sub Form_Load()ShowPrint "┌────┬────┬────┐" vbCrLf _ "│ 库存1 │ 库存2 │ 库存3 │" vbCrLf _ "├────┼────┼────┤" vbCrLf _ "│" formatstr(a) "│" formatstr(b) "│" formatstr(c) "│" vbCrLf _ "└────┴────┴────┘" End SubPrivate Function formatstr(ByVal inputStr As String) As StringDim j As Integerj = (8 - Len(inputStr)) \ 2formatstr = Space(j) inputStr Space(j) Space((8 - Len(inputStr)) Mod 2)End Function‘将以下代码复制在form1窗体中Private Sub Command1_Click()Form2.ShowEnd Sub
如何 在 vb.net 中 按下键盘A与W 两个按键组合时弹出 MsgBox("你按下了A+W键"),最好有例子程序。
楼上的按了一次A+W后,接下来单按W键就会弹出信息框
Public Class Form1
Private Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal keyCode As Integer) As Short
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If GetAsyncKeyState(Keys.A) And GetAsyncKeyState(Keys.W) Then
MsgBox("你按下了A+W键")
End If
End Sub
End Class
按照顺序的话,这样写:
Public Class Form1
Private Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal keyCode As Integer) As Short
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If GetAsyncKeyState(Keys.A) And e.KeyCode = Keys.W Then
MsgBox("你按下了A+W键")
End If
End Sub
End Class
望采纳~
vb.net 怎么让 win10 弹出系统通知
自己创建个无边框窗体 控制下显示位置 不就好了
样式图标随你设计
VB.NET 窗口弹出问题
你在第一个窗口里写 Form2.ShowDialog()
这样就可以了,关掉form2的时候form1的代码就会继续执行
网站栏目:vb.net弹出信息 vbnet doevent
文章转载:http://pwwzsj.com/article/dohchee.html