用vb6连接字符串 [英] Concatenate strings with vb6

查看:61
本文介绍了用vb6连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在vb6中进行连接。不支持运算符+ =,我想做下面的代码。我想在程序中处理更多代码时在文本框中添加更多字符串。谁能建议将+ =更改为什么?我知道&可以在将一个字符串添加到另一个字符串时使用,但这在我在此工作的示例中似乎不合适。

I am trying to concatenate in vb6. The operator += is not supported, and I want to do something like the code below. I want to add more strings to a textbox as the program works down this code. Can anyone advise what to change += to? I know & can be used when adding one string to another, but it the example I am working on here, that doesn't seem suitable.

谢谢。

    If (strHomeNo <> "") Then
        txtPhoneNums = "Home: " + strHomeNo
    End If
    If (strMobileNo <> "") Then
        txtPhoneNums += "Mobile: " + strMobileNo
    End If
    If (strWorkNo <> "") Then
        txtPhoneNums += "Work: " + strWorkNo
    End If
    If (txtPhoneNums <> "") Then
        txtPhoneNums.ForeColor = vbBlack
        txtPhoneNums.FontBold = False
    End If
Else
     txtPhoneNums.Text = "NO CONTACT DETAILS"
     txtPhoneNums.ForeColor = vbRed
     txtPhoneNums.FontBold = True


推荐答案

将:

txtPhoneNums = txtPhoneNums & "Work: " & strWorkNo

不起作用?

这篇关于用vb6连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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