以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  请教:想用CheckedComboBox1控件显示该文本框每一行  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=31410)

--  作者:kevin
--  发布时间:2013/4/14 16:15:00
--  请教:想用CheckedComboBox1控件显示该文本框每一行
窗口中,有一个多行文本框
想用CheckedComboBox1控件显示该文本框每一行(不重复)的内容;请问如何写这个代码

--  作者:lsy
--  发布时间:2013/4/14 17:27:00
--  

Dim txt As WinForm.TextBox = e.Form.Controls("TextBox1")
Dim str As String
Dim i,j As Integer
For i = 0 To txt.Lines.Length - 1
    For j = 0 To i - 1
        If txt.Lines(i) = txt.Lines(j) Then
            Exit For
        End If
    Next
    If i = j Then
        str = str & txt.Lines(i) & "|"
    End If
Next
str = str.TrimEnd("|")
e.Form.Controls("CheckedComboBox1").ComboList = str

 

[此贴子已经被作者于2013-4-15 16:38:44编辑过]

--  作者:菲舍尔
--  发布时间:2013/4/14 23:47:00
--  
e.form.controls("checkcombobox1").combolist = e.form.control("多行文本框控件名").text.replace(chr(10),"|")
这个是没有去掉重复值的



--  作者:lsy
--  发布时间:2013/4/15 16:34:00
--  
以下是引用菲舍尔在2013-4-14 23:47:00的发言:
e.form.controls("checkcombobox1").combolist = e.form.control("多行文本框控件名").text.replace(chr(10),"|")
这个是没有去掉重复值的


上面那答案,是抄袭别人的,感谢那个人,与大家分享。

[此贴子已经被作者于2013-4-15 16:36:23编辑过]