VB.NET代码没有在Visual Studio下执行它应该的方式 [英] VB.NET Code not executing the way it should under Visual Studio

查看:95
本文介绍了VB.NET代码没有在Visual Studio下执行它应该的方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我想问一个问题,我在vb.net上做一个应用程序,而我的if其他行为很奇怪,而不是在标签中说明正确的标题,而是显示else语句,而不是你有什么你想说的除此之外吗?...
先谢谢你们了:)
这里是我的代码先生:

Hi I would like to ask a question guys I am doing an application in vb.net and my if else is acting weird instead of stating the correct caption in the label it shows the else statement instead which is "Do you have anything you want to say other than that?"... Thanks in advance guys :) here is my code sirs:

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    If TextBox1.Text = "What is your name?" Then
        Label1.Text = "Hi there kid! I will tell you later"
    Else
        Label1.Text = "Do you have anything you want to say other than that?"
        If TextBox1.Text = "Hi" Then
            Label1.Text = "Hi there also!"

        Else
            Label1.Text = "Do you have anything you want to say other than that?"
        End If
    End If
End Sub 


推荐答案

访问你的项目文件夹,前往调试文件夹并删除那里可以删除的所有内容,忽略任何无法删除的内容,因为它已加载到内存中。我没有看到代码有什么问题,如果你的代码很有趣,Visual Studio可能没有用新编译的那个替换debug文件夹中的那个,这意味着正在运行的应用程序是在错误发生之前编译的最后一个。这是Visual Studio中的常见错误。

Access your project folder, head to the debug folder and delete everything there that can be deleted, ignore anything that can't be deleted because it's loaded in the memory. I don't see anything wrong with the code, if your code is acting funny, Visual Studio might have not replaced the one in the debug folder with the newly compiled one, which means the running app is the last one compiled before the error happened. This is a common bug in Visual Studio.

这篇关于VB.NET代码没有在Visual Studio下执行它应该的方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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