vb listbox,如何在Form中print打印list中的全部条目?
PrivateSubCommand1_Click()PrintForm2.List1这样写发现只print打印list中选中的条目。在线求解,解决追加分数...
Private Sub Command1_Click()
Print Form2.List1
这样写发现只print打印list中选中的条目。在线求解,解决追加分数 展开
Print Form2.List1
这样写发现只print打印list中选中的条目。在线求解,解决追加分数 展开
4个回答
展开全部
'//保存
Private Sub Form_Unload(Cancel As Integer)
Dim i As Long, Temp As String
For i = 0 To List1.ListCount - 1
If Temp = "" Then
Temp = List1.List(i)
Else
Temp = Temp & vbNewLine & List1.List(i)
End If
Next i
Open IIf(Len(App.Path) = 3, App.Path, App.Path & "\") & "data.dat" For Output As #1
Print #1, List1.ListCount & vbNewLine & Temp
Close #1
End Sub
'//加载
Private Sub Form_Load()
Dim Path As String, Item As Long, Temp As String, i As Long
Path = IIf(Len(App.Path) = 3, App.Path, App.Path & "\") & "data.dat"
If Dir(Path, vbDirectory) = "" Then Exit Sub
Open Path For Input As #1
Line Input #1, Temp
Item = Val(Temp)
For i = 1 To Item
Line Input #1, Temp
List1.AddItem Temp
Next i
Close #1
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim i As Long, Temp As String
For i = 0 To List1.ListCount - 1
If Temp = "" Then
Temp = List1.List(i)
Else
Temp = Temp & vbNewLine & List1.List(i)
End If
Next i
Open IIf(Len(App.Path) = 3, App.Path, App.Path & "\") & "data.dat" For Output As #1
Print #1, List1.ListCount & vbNewLine & Temp
Close #1
End Sub
'//加载
Private Sub Form_Load()
Dim Path As String, Item As Long, Temp As String, i As Long
Path = IIf(Len(App.Path) = 3, App.Path, App.Path & "\") & "data.dat"
If Dir(Path, vbDirectory) = "" Then Exit Sub
Open Path For Input As #1
Line Input #1, Temp
Item = Val(Temp)
For i = 1 To Item
Line Input #1, Temp
List1.AddItem Temp
Next i
Close #1
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click()
For i= 0 to List1.ListCount
Print Form2.list1.list(i)
Next i
End
For i= 0 to List1.ListCount
Print Form2.list1.list(i)
Next i
End
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
FOR i=0 to List1.ListCount-1
print list1.list(i)
Next
print list1.list(i)
Next
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
FOR i=0 to List1.ListCount
print list1.list(i)
Next
print list1.list(i)
Next
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询