各位大侠,帮帮忙!!我想在数据库中读取如此"abc bcd dkf eof wsos ke"的一个数据到list1/dbList中。但我想它读取到list1 中的时候,格式为
"abc"
"bcd"
"dkf"
.
.
.
这样的一个数据,,也就是说逢空格后转行!!急!!小弟在此等候,,,谢谢!!

解决方案 »

  1.   

    dim str as string,tmpStr as string,i as integer
    str = "abc bcd dkf eof wsos ke"
    for i = 1 to len(str)
        if right$(left$(str,i),1) = chr$(32) then
            Str = left(str,i-1) & chr$(13) & chr$(10) & right$(str,len(str)-i)
        end if
    next i初学VB,难免不足,仅供参考,请勿模仿
      

  2.   

    dim str as string, i as integer
    dim arr 
    str = "abc bcd dkf eof wsos ke"arr=split(str," ")
    for i=0 to ubound(arr)
       list1.addnewItem arr(i)
    next
      

  3.   

    Dim substr() As String
    Dim i As Integer
    Dim str As String
    str = "abc bcd dkf eof wsos ke"
    substr = Split(str, " ")
    List1.Clear
    For i = 0 To UBound(substr)
        List1.AddItem substr(i)
    Next i
      

  4.   

    使用 UBound 返回的结果是倒过来的,,有办法解决吗??
      

  5.   

    呵呵,那就这样喽
    for i=ubound(arr) to 0
       list1.addnewItem arr(i)
    next
      

  6.   

    //for i=ubound(arr) to 0
       list1.addnewItem arr(i)
    next
    你得加上Step -1