vb.net“预期表达”是什么意思

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14538717/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 16:37:38  来源:igfitidea点击:

what does vb.net mean by "expression expected"

vb.netexpressionlistitem

提问by user1944225

i dont know what to put after the bracket of the list item class, so their is an error saying

我不知道在列表项类的括号后面放什么,所以他们是一个错误说

expression expected

表达预期

This is the code:

这是代码:

Dim NewEntry As New ListItem(CostOfGame & " " & Ps3Games & " " & GameID & " " & IsTheGameInStock & " " &)

Also, can you please explain to me what list item does in simple terms as i still dont understand it?

另外,您能否用简单的术语向我解释列表项的作用,因为我仍然不明白?

回答by Edwin

You have an extra '&' at the end of your expression. It should just be:

您的表达式末尾有一个额外的“&”。它应该只是:

Dim NewEntry As New ListItem(CostOfGame & " " & Ps3Games & " " & GameID & " " & IsTheGameInStock & " ") 

As to what a ListItem is and what it does, see the documentation. I suspect, though that an answer that you want is a little broader and beyond the scope of this site.

关于 ListItem 是什么以及它的作用,请参阅文档。我怀疑,尽管您想要的答案范围更广,超出了本网站的范围。

回答by chue x

You have an extra ampersand in there (the last one):

你在那里有一个额外的&符号(最后一个):

... IsTheGameInStock & " " &)

回答by chue x

It means you are using syntax in an incomplete fashion. For math, you are forgetting to use an equal sign "=" on the line throwing the exception. You are forgetting to say for example

这意味着您以不完整的方式使用语法。对于数学,您忘记在抛出异常的行上使用等号“=”。例如你忘记说

Dim x As Single

x = Math.Sqrt(16)

but you are doing something like

但你正在做类似的事情

Math.Sqrt(16)

or you do are something like

或者你是这样的

InStr(string,"hello")>0 

instead of

代替

If InStr(string,"hello")>0 Then
   .....
End IF