如何自动设置文本? [英] how to set text automatically?

查看:77
本文介绍了如何自动设置文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好......



如何自动在文本框中设置文字?



例如:



if textbox1.text =shutdownthen

textbox2.text =ok shut down

结束如果



但是即使在tectbox1.text中指示关闭,textbox2.text也没有表示ok关闭这句话



这是我的代码:



 私有  Sub  shutdown()

如果 receiveRT.Text = 关闭 shutdown 然后
SendRT.Text = 关闭
结束 如果

如果 SendRT.Text = 关闭 然后
使用 srPort
.Write( AT
。写( AT + CMGF = 1& vbCrLf)
.Write( AT + CMGS =& Chr( 34 )& CNtbox.Text& Chr( 34 )& vbCrLf)
.Write(SendRT .Text& Chr( 26 ))
MsgBox( 发送消息

结束 使用
结束 如果

结束 如果
结束 Sub

解决方案

通过设置!

在您的示例中,您没有设置text属性,你只需测试它的特定值:

如果 receiveRT.Text = 关闭 shutdown 然后
如果 SendRT.Text = 关闭 然后


hi there...

how to set text in textbox automatically?

for example:

if textbox1.text = "shutdown" then
textbox2.text = "ok shutting down"
end if

but even though shutdown is indicated in tectbox1.text, textbox2.text does''nt indicate the phrase "ok shutting down"

here is my code:

Private Sub shutdown()

       If receiveRT.Text = "Shutdown" Or "shutdown" Then
           SendRT.Text = "Shutting Down" 
end if

           If SendRT.Text = "Shutting Down" Then
               With srPort
                   .Write("AT")
                   .Write("AT+CMGF=1" & vbCrLf)
                   .Write("AT+CMGS=" & Chr(34) & CNtbox.Text & Chr(34) & vbCrLf)
                   .Write(SendRT.Text & Chr(26))
                   MsgBox("Message sent")

               End With
           End If

       End If
   End Sub

解决方案

By setting it!
In your sample, you do not set the text property, you just test it for a specific value:

If receiveRT.Text = "Shutdown" Or "shutdown" Then
    If SendRT.Text = "Shutting Down" Then


这篇关于如何自动设置文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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