我是VB和编程的新手 - 我只使用了命令提示符 [英] I'm New to VB and Programming - I've only used Command Prompt

查看:74
本文介绍了我是VB和编程的新手 - 我只使用了命令提示符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的scrpit,当我尝试调试它时,它继续做一些愚蠢的事情从字符串转换"输入''Double''是无效的。我会把它引用为粗线...

Here is my scrpit,, when I try debugging it it keeps doing something stupid saying Conversion from string "" to type ''Double'' is not valid. I will make the line it''s refering to bold...

展开 | 选择 | Wrap | 行号

推荐答案

乍一看,我会说变量 X 需要是数字。 MsgBox函数返回一个数字,而不是一个字符串。
At first glance, I''d say variable X needs to be numeric. The MsgBox function returns a number, not a string.



这是我的scrpit,当我尝试调试它时,它继续做一些愚蠢的事情说从字符串转换""输入''Double''是无效的。我会把这条线称为粗体......


Public Class Form1

Dim X As String

Dim Password,PWord

Private Sub Form1_Load(ByVal sender As System.Object,ByVal e As System.EventArgs)Handles MyBase.Load

X = InputBox(请为此应用程序设置你的密码。)

如果X = vbCancel那么MsgBox(你必须设置密码!) )

Do X = vbOKOnly

X = InputBox(请为此应用程序设置您的密码。)
如果X = vbCancel然后 MsgBox(你必须设置密码!)

如果X = vbOKOnly然后显示(我)

循环

End Sub

Dim R As String

Dim Z As String

Private Sub Button1_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)处理Button1.Cli ck

X = InputBox(请为此应用程序设置你的密码。)

如果X = vbCancel则退出Sub

X = Chr(62)

End Sub

Private Sub Button2_Click(ByVal sender As System.Object,ByVal e As System.EventArgs)处理Button2.Click

R = InputBox(请输入您的密码)

如果R = X则MsgBox(您已被清除以进入!)

如果R< R> X然后MsgBox(抱歉错误密码,不错的尝试...)

结束次级

结束班级




视觉部分下的所有内容都是两个按钮,一个用于设置密码,另一个用于输入密码...


我是试图让它退出MSGBOX并返回INPUTBOX并循环,这样你就必须为它设置一个值,否则它不会继续,有人PLZ帮助我(如果你试图解释它对我来说,请尝试从头开始向我解释,因为我不知道我在做什么,而且我是新手。


THANX很多人都在试图帮助我!
Here is my scrpit,, when I try debugging it it keeps doing something stupid saying Conversion from string "" to type ''Double'' is not valid. I will make the line it''s refering to bold...

Public Class Form1
Dim X As String
Dim Password, PWord
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
X = InputBox("Please SET your PASSWORD for this application.")
If X = vbCancel Then MsgBox("YOU HAVE TO SET A PASSWORD!")
Do Until X = vbOKOnly
X = InputBox("Please SET your PASSWORD for this application.")
If X = vbCancel Then MsgBox("YOU HAVE TO SET A PASSWORD!")
If X = vbOKOnly Then Show(Me)
Loop
End Sub
Dim R As String
Dim Z As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
X = InputBox("Please SET your PASSWORD for this application.")
If X = vbCancel Then Exit Sub
X = Chr(62)
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
R = InputBox("Please Enter your Password")
If R = X Then MsgBox("You are cleared for entry!")
If R <> X Then MsgBox("Sorry WRONG Password, Nice Try...")
End Sub
End Class



All that I have under the visual part are two buttons, one to set the password, and another to input it...

I''m trying to make it exit the MSGBOX and return to the INPUTBOX and loop, so that you have to put a value in for it, or it won''t continue, SOMEONE PLZ help me (and if you attempt to explain it to me please try to explain it to me from scratch, because I have no clue what I''m doing and I''m new at this.)

THANX ALOT TO ANYONE WHO TRYS HELPING ME!!





回复:请将变量x定义为整数b / c VBCancel返回的数字值为3,即取消按钮





Reply :Please define your variable x as integer b/c VBCancel returns the neumeric value which is 3 which is for cancel button


从字符串SET转换输入整数是无效的。是我在将X调整为整数时得到的答案
Conversion from string "SET" to type ''Integer'' is not valid. is the reply I get when I "dim X as integer"


这篇关于我是VB和编程的新手 - 我只使用了命令提示符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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