strUserName = String(100, Chr$(0))
'Get the username
GetUserName strUserName, 100
'strip the rest of the buffer
GetUserNameInfo = Left$(strUserName, InStr(strUserName, Chr$(0)) - 1)如上代码,为什么有时函数和参数之间有(,有时没有?函数后加$表示什么?
'Get the username
GetUserName strUserName, 100
'strip the rest of the buffer
GetUserNameInfo = Left$(strUserName, InStr(strUserName, Chr$(0)) - 1)如上代码,为什么有时函数和参数之间有(,有时没有?函数后加$表示什么?
例如:
msgbox "Test",vbYesNo ,"Test" '显示"Test"这一行字符串,没有返回值
i=msgbox("test",vbYesNo,"test") '显示"Test"这一行字符串,并返回用户点击了哪个按钮给i变量,如用户按了yes ,则i=vbYes,按了No,则i=vbNo
$有没有都行,可能是指此函数的功能是处理字符串的吧。
有些函數後加$表示返回值是字符,該函數是字符型函數
例如 Left 和 Left$ 是一樣的
函数加上$表示是低版本的,为了向下兼容.
Suron128(辰龍) & cuizm(射天狼)
怎么我这一句都看不到啊?
“msgbox now和msgbox(now())效果是一样的”,now是有返回值的,可以不加括号
liul17(liul)的是正解
VB有三种调用方式,一种为不加括号,一种有,一种为CALL
具体的可以看看书吧