我想检查一个if语句

我想检查一个if语句

本文介绍了我想检查一个if语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我想要一个检查按键是否被按下的代码,该代码将是:

hello there, i want a code that checks a key if it is pressed, the code will be:

if If num_of_routing = 1 And "_refresh button is pressed" then messagebox.show("Make sure you have made the first route"



我需要_refresh按钮的代码或功能(如果按下),对于VB来说是个新手,所以谢谢大家.



i need the code or function of the _refresh button if pressed , am very new to VB, so thanks for every one.

推荐答案

If Num_Of_Routing = 1 Then
  MessageBox.Show("Make sure you have made the first route")
End If

要获取Click事件处理程序,请在Visual Studio中打开表单,然后双击按钮.这将为您创建一个空的Click事件处理程序,或将您带到您之前添加的事件处理程序.

To get the Click event handler, open up your form in Visual Studio, and double click on the button. This will either create an empty Click event handler for you, or take you to one that you''ve added previously.


Public Class Form1
    Dim iKeyPressed As Integer = 0

    Private Sub RefreshBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RefreshBtn.Click
        iKeyPressed += 1
    End Sub

    Private Sub OtherBtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OtherBtn.Click
        MsgBox("Refresh button was pressed: " & iKeyPressed.ToString & " times", MsgBoxStyle.Information, "Info...")
    End Sub
End Class



这篇关于我想检查一个if语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 18:46