MsgBox w / Yes&不(VB.net) [英] MsgBox w/ Yes & No (VB.net)

查看:48
本文介绍了MsgBox w / Yes&不(VB.net)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好!

我正在使用Microsoft Visual Studio 2005.



如何制作一个可以确认操作的消息框?

这是我的代码:

Hello!
I am using Microsoft Visual Studio 2005.

How can I make a message box that can confirm action?
This is my code:

Private Sub BTNunlock_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNunlock.Click
        Try
            sqlsa = "UPDATE MAS_Users set islocked='0' WHERE empno='" & TBempno.Text & "'"
            con.NoReturnQuery(sqlsa)
        Catch ex As Exception
            MsgBox("Error!", MsgBoxStyle.Critical)
        End Try
    End Sub





当我点击按钮时,我想显示一个消息框,上面写着:确认更新?使用按钮:是或否



如果选择是,我的数据将更新,如果没有,那么否。

我如何制作一个?



提前致谢! :)



When I click the button, i want to show a message box that says: Confirm update? with the buttons: Yes or No

if picked yes, my data will update, if not, then no.
How can i make one?

Thanks in advance! :)

推荐答案

希望下面的代码示例有所帮助 -



Hope the below code example will help -

Dim result As DialogResult = MessageBox.Show("Confirm update?", _
                              "Title", _
                              MessageBoxButtons.YesNo)

If(result == DialogResult.OK)
    Update data here
Else
    Nothing
End If


这一个.. (简单的一个)



this one... (simple one)

Dim ans as string
ans= Msgbox "Confirm Update", vbYesNo
if ans= vbYes then
 'code to update
end if


Dim ask As MsgBoxResult = MsgBox("What you Want", MsgBoxStyle.YesNo)
       If ask = MsgBoxResult.Yes Then

       End If


这篇关于MsgBox w / Yes&不(VB.net)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆