VB.NET中.LISTBOX.ITEMS.ADD的问题.
ds = clsCommon.GetData(sqlStr)
dt = ds.Tables(0)
dr = dt.CreateDataReader()
While dr.Read
If dr.IsDBNull(0) = False And dr.IsDBNull(2) = False Then
'Format ArticleID and TimingID
'result value add to Arraylist
snum = 22
c_moji = dr.GetString(1)
Call Char_check(c_moji, snum)
'Add to ArticleList
Me.lstArticle.Items.Add(dr.GetString(1) & Space(snum) & dr.GetString(3))
End If
End While
-----Char_check-----
Public Sub Char_check(ByRef c_moji As String, ByRef spc_su As Integer)
'Variable for byte type conversion
Dim enco As System.Text.Encoding = System.Text.Encoding.Unicode
Dim Unibyte() As Byte
Dim snum As Integer ' Number of space of stuff in back
Dim han_su, zen_su As Integer ' Em-size and one-byte character number counter
Dim i As Integer ' Counter
'The received character string is converted into byte type.
Unibyte = enco.GetBytes(c_moji)
'Initialization of variable
han_su = 0
zen_su = 0
For i = 1 To Unibyte.Length - 1 Step 2
'' When the logic em-size that distinguishes signs of em-size is distinguished, here is made On.
If (Unibyte(i) = &H0 And (&H20 <= Unibyte(i - 1) And Unibyte(i - 1) <= &H7D)) Or _
(Unibyte(i) = &HFF And (&H61 <= Unibyte(i - 1) And Unibyte(i - 1) <= &H9F)) Then
'--------------------------------------------------------------
'When em-size is distinguished for the alphanumeric character,
'the sign, and the normal-width katakana, here is turned off.
'--------------------------------------------------------------
'One-byte character
han_su += 1
Else
'Em-size character
zen_su += 1
End If
Next
'The number of stuffed space is calculated from the character distinction.
snum = spc_su
snum = snum - ((zen_su * 2) + han_su)
'When the character string exceeds the display area
If snum < 1 Then
snum = 1
'c_moji = enco.GetString(Unibyte, 1, 24)
End If
'The number of stuffed space is returned.
spc_su = snum
End Sub
将数据库里两个字段的数据加起来ADD到LISTBOX里.但是通过上面的那个方法取出来的数据不能达到我预期的效果.
预想得到的效果是:
品目 使用時期
品目一 使用时期一
品目二 使用时期二
请各位高手指导一下....
谢谢....