if计数语句 [英] if statement with count

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

问题描述

你好,
我的if语句有问题.我正在尝试将用户重定向到一个页面(如果count = 0,否则将其重定向到另一个页面).

Hi there,
I am having a problem with my if statement. I am trying to redirect the user to a page if count = 0 else to another page.

Dim count As Integer
count = Convert.ToInt32(txtCount.Text)
If (count = 0) Then
    Response.Redirect = ("NewBookings.aspx")

ElseIf (count > 0) Then
    Response.Redirect = ("TicketAvailable.aspx")
End If


错误读取:


error reads:

Error	1	Overload resolution failed because no accessible 'Redirect' accepts this number of arguments.

推荐答案

try这个...
try this...
Response.Redirect("NewBookings.aspx")


错误表示它的意思.我认为Response.Redirect也将bool作为第二个参数.另外,为什么还要检查两次?可能是< 0?

使用智能感知功能,在页面名称后放置一个,它将告诉您期望使用的其他参数.
The error means what it says. I think that Response.Redirect also takes a bool as a second argument. Also, why check it twice ? Might it be < 0 ?

Use the intellisense, put a , after the page name and it will tell you what other arguments it expects.


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

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