3个回答
展开全部
Dim c As Control
For Each c In Me.Controls
If TypeOf c Is TextBox Then
List1.AddItem (c.Name)
End If
Next
最新版本如上。是这样的么?
遍历创题上Text1.Text的名字?它的名字不是Text1么?
你是不是要读取Text1.Text里面每一行,每一行都显示在List上?
按照这个问题的回答:
(你可以使用API,但是使用文件方式可能更加简单)
Sub ShowOnList(SourceText As TextBox, ToList As ListBox)
Dim Inputstr As String
Dim TimeAt As String
TimeAt = Hex(Year(Date)) & Hex(Month(Date)) & Hex(Day(Date)) & Hex(Hour(Time)) & Hex(Minute(Time)) & Hex(Second(Time)) '生成唯一标识
Open "C:\tmp" & TimeAt & ".tmp" For Output As #1
Print #1, SourceText.Text
Close #1
Open "C:\tmp" & TimeAt & ".tmp" For Input As #1
Do Until EOF(1)
Line Input #1, Inputstr
ToList.AddItem Inputstr
Loop
Close #1
Kill "C:\tmp" & TimeAt & ".tmp"
End Sub
使用:
ShowOnList Text1, List1
For Each c In Me.Controls
If TypeOf c Is TextBox Then
List1.AddItem (c.Name)
End If
Next
最新版本如上。是这样的么?
遍历创题上Text1.Text的名字?它的名字不是Text1么?
你是不是要读取Text1.Text里面每一行,每一行都显示在List上?
按照这个问题的回答:
(你可以使用API,但是使用文件方式可能更加简单)
Sub ShowOnList(SourceText As TextBox, ToList As ListBox)
Dim Inputstr As String
Dim TimeAt As String
TimeAt = Hex(Year(Date)) & Hex(Month(Date)) & Hex(Day(Date)) & Hex(Hour(Time)) & Hex(Minute(Time)) & Hex(Second(Time)) '生成唯一标识
Open "C:\tmp" & TimeAt & ".tmp" For Output As #1
Print #1, SourceText.Text
Close #1
Open "C:\tmp" & TimeAt & ".tmp" For Input As #1
Do Until EOF(1)
Line Input #1, Inputstr
ToList.AddItem Inputstr
Loop
Close #1
Kill "C:\tmp" & TimeAt & ".tmp"
End Sub
使用:
ShowOnList Text1, List1
展开全部
建一个Command1。
代码如下。
==============
Private Sub Command1_Click()
Dim i As Long
For i = 1 To Len(Text1.Text)
List1.AddItem Mid(Text1.Text, i, 1)
Next
End Sub
代码如下。
==============
Private Sub Command1_Click()
Dim i As Long
For i = 1 To Len(Text1.Text)
List1.AddItem Mid(Text1.Text, i, 1)
Next
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Private Sub Command1_Click()
For i = 0 To Form1.Count - 1
If TypeOf Form1.Controls(i) Is TextBox Then
List1.AddItem Form1.Controls(i).Name
End If
Next
End Sub
For i = 0 To Form1.Count - 1
If TypeOf Form1.Controls(i) Is TextBox Then
List1.AddItem Form1.Controls(i).Name
End If
Next
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询