VB6.0中如何让下面这段代码的结果显示在text窗口 5
PrivateSub计算_Click()w1=ComboBox1.Textw2=ComboBox2.Textw3=ComboBox3.TextIfw1=3Andw2<=1...
Private Sub 计算_Click()
w1 = ComboBox1.Text
w2 = ComboBox2.Text
w3 = ComboBox3.Text
If w1 = 3 And w2 <= 125 And w3 = A Then
TextBox1 = 12: TextBox2 = 0.4: TextBox3 = 4.57: TextBox4 = 6.01: TextBox5 = 2: TextBox6 = 0.1: TextBox7 = 5.5 展开
w1 = ComboBox1.Text
w2 = ComboBox2.Text
w3 = ComboBox3.Text
If w1 = 3 And w2 <= 125 And w3 = A Then
TextBox1 = 12: TextBox2 = 0.4: TextBox3 = 4.57: TextBox4 = 6.01: TextBox5 = 2: TextBox6 = 0.1: TextBox7 = 5.5 展开
1个回答
展开全部
用字符串连接起来就可以了,把TextBox控件的MultiLine属性设置为True 可以分行显示
dim str as string
str="Private Sub 计算_Click()“ & vbcrlf
str=str & "w1 = ComboBox1.Text" & vbcrlf
str=str & "w2 = ComboBox2.Text" & vbcrlf
str=str & "w3 = ComboBox3.Text" & vbcrlf
str=str & "w3 = ComboBox3.Text" & vbcrlf
str=str & "If w1 = 3 And w2 <= 125 And w3 = A Then" & vbcrlf
str=str & "TextBox1 = 12: TextBox2 = 0.4: TextBox3 = 4.57: TextBox4 = 6.01: TextBox5 = 2: TextBox6 = 0.1: TextBox7 = 5.5" & vbcrlf
你的Textbox控件.text=str
dim str as string
str="Private Sub 计算_Click()“ & vbcrlf
str=str & "w1 = ComboBox1.Text" & vbcrlf
str=str & "w2 = ComboBox2.Text" & vbcrlf
str=str & "w3 = ComboBox3.Text" & vbcrlf
str=str & "w3 = ComboBox3.Text" & vbcrlf
str=str & "If w1 = 3 And w2 <= 125 And w3 = A Then" & vbcrlf
str=str & "TextBox1 = 12: TextBox2 = 0.4: TextBox3 = 4.57: TextBox4 = 6.01: TextBox5 = 2: TextBox6 = 0.1: TextBox7 = 5.5" & vbcrlf
你的Textbox控件.text=str
更多追问追答
追问
不好意思,问题没有说清楚,我上面贴的这段代码是后台的代码不是所有都显示只是想让条件语句判定后结果显示在相应的textbox下(而且我贴出的只是一条if判定,实际代码有几十条,这样有区别么),后续还需要用到这些数据来执行一些命令。怎么才能达到这样的目的呢?
追答
将计算的数据显示在textbox控件上面是吗? 你这个应该没有问题吧
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询