具有多个文本框的if语句,用于从中获取值 [英] If statement with several textboxes to get the values from

查看:75
本文介绍了具有多个文本框的if语句,用于从中获取值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我的项目有问题.我想做的是如果那里的计数大于等于2,则显示禁用按钮.但是,如果busNumber = txtbusNumber.text和date = txtDay.text并且count = txtCount.text,则需要这样做.
所有这些都存储在数据库中.即使计数正常,我也可以检索它们.
这是我到目前为止的代码.

Hi guys, am having a problem with my project. wat i want to do is display disable the button if there count is greater than equals to 2. but need to do so if busNumber = txtbusNumber.text and date = txtDay.text and count = txtCount.text.
all this are stored in the database.. i can retrieve them all even the count is working.
this is the code i have so far.

if txtBusNumber.Text = "AT01" And cmbDay.Text = "Monday" And txtCount.Text >= 2 Then
            txtNotification.Text = ""
            btnConfirm.Enabled = False
            txtNotification.Text = "Sorry Bus from " & cmbDepart.Text & " to " & cmbDestination.Text & " is fully booked"
        Else
            btnConfirm.Enabled = True
            txtNotification.Text = "Ticket Available"

        End If



请帮助..谢谢



please help.. thanks

推荐答案

我认为这不能编译?如果txtCount.Text是一个数字,则应该使用int.TryParse进行计算,如果是,则可以进行比较.我不明白您余下的问题,您在这里还要问更多吗?什么是busNumber?如果它是变量,为什么不与之比较?
I assume this does not compile ? You should use int.TryParse to work out if txtCount.Text is a number, then if it is, you can compare it. I don''t understand the rest of your question, is there more you''re asking here ? What is busNumber ? If it''s a variable, why not compare to it ?


您需要将txtCount.Text> = 2替换为"Convert.ToInt32(txtCount.Text)> = 2"
you need to replace txtCount.Text >= 2 with "Convert.ToInt32(txtCount.Text) >= 2"


昏暗计数为整数
计数= Convert.ToInt32(txtCount.Text)
如果(count> = 3)并且cmbDay.Text =星期一"和txtBusNumber.Text ="AT02"然后
btnConfirm.Enabled = False

txtNotification.Text =巴士已满"

如果结束


不是在init下,而是在命令下
Dim count As Integer
count = Convert.ToInt32(txtCount.Text)
If (count >= 3) And cmbDay.Text = "Monday" And txtBusNumber.Text = "AT02" Then
btnConfirm.Enabled = False

txtNotification.Text = "Bus Fully Booked"

End If


not under init, but under command


这篇关于具有多个文本框的if语句,用于从中获取值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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