vb如何将text文本中的内容输入到数组里去?
比如我创建一个控件text1,数组a(),想要把用户输入到特text1中的内容输入到a()中该怎么写代码?急,详细解说的更好,给追加分!!二楼的大虾你的代码在VB上我运行...
比如我创建一个控件text1,数组a(),想要把用户输入到特text1中的内容输入到a()中该怎么写代码?急,详细解说的更好,给追加分!!
二楼的大虾你的代码在VB上我运行出错阿,你调试过了吗?一楼的纯属害人``` 展开
二楼的大虾你的代码在VB上我运行出错阿,你调试过了吗?一楼的纯属害人``` 展开
展开全部
首先a()必须是字符串变量
可以在text1的change事件中写代码
a(...)=text1.text '不知道你的数组的下标是那个
这样回答好像太简单了,好长时间没有看VB6的书籍了,我也懒得看了,差不多都忘了!遥想,好像是我上大一时,学的VB,当时学感觉很实用,学的挺有劲的!现在看来,VB6确实该退出历史舞台了,最好学一些面向对象的开发工具!VC++,.NET,mfc,或java都行!不过如果是大学里面开的这门课,为了混学分,学学也行!没有必要学的很深,混个及格就行!确实如此,现在学学VB.net,都比学VB要强!毕竟后者有较强的面向对象思想!如果你的VB6学的太好,对你将来学VB.net可能会有一点点误导!况且现在几乎没有什么东西是用VB6开发的!我认为你倒不如直接从学vb.net开始,vb6混个及格就行了!我也是多年的实践经验,并不是建议你玩世不恭,大学里的日子好过,但是不能白过了,要学一技之长!切记,要学的东西好多好多!
可以在text1的change事件中写代码
a(...)=text1.text '不知道你的数组的下标是那个
这样回答好像太简单了,好长时间没有看VB6的书籍了,我也懒得看了,差不多都忘了!遥想,好像是我上大一时,学的VB,当时学感觉很实用,学的挺有劲的!现在看来,VB6确实该退出历史舞台了,最好学一些面向对象的开发工具!VC++,.NET,mfc,或java都行!不过如果是大学里面开的这门课,为了混学分,学学也行!没有必要学的很深,混个及格就行!确实如此,现在学学VB.net,都比学VB要强!毕竟后者有较强的面向对象思想!如果你的VB6学的太好,对你将来学VB.net可能会有一点点误导!况且现在几乎没有什么东西是用VB6开发的!我认为你倒不如直接从学vb.net开始,vb6混个及格就行了!我也是多年的实践经验,并不是建议你玩世不恭,大学里的日子好过,但是不能白过了,要学一技之长!切记,要学的东西好多好多!
展开全部
楼上的做人要厚道啊
dim
a()
as
string
redim
a(len(text1.text)-1)
as
string
for
i=0
to
len(text1.text)-1
a(i)=mid(text1.text,i+1,1)
next
补充:不知道你是不是用VB调试的,是不是忘了添加控件,我在知道里的回答绝对是先调试后回答的,如果还是不行,你把下边的******中间的代码复制到文本文件并改名为form1.frm,在代码里加了把a()打印出来的代码
********************************************************
VERSION
5.00
Begin
VB.Form
Form1
Caption
=
"Form1"
ClientHeight
=
3090
ClientLeft
=
60
ClientTop
=
450
ClientWidth
=
4680
LinkTopic
=
"Form1"
ScaleHeight
=
3090
ScaleWidth
=
4680
StartUpPosition
=
3
'窗口缺省
Begin
VB.TextBox
Text1
Height
=
735
Left
=
720
TabIndex
=
1
Text
=
"Text1"
Top
=
1560
Width
=
3135
End
Begin
VB.CommandButton
Command1
Caption
=
"Command1"
Height
=
495
Left
=
1920
TabIndex
=
0
Top
=
360
Width
=
1455
End
End
Attribute
VB_Name
=
"Form1"
Attribute
VB_GlobalNameSpace
=
False
Attribute
VB_Creatable
=
False
Attribute
VB_PredeclaredId
=
True
Attribute
VB_Exposed
=
False
Private
Sub
Command1_Click()
Dim
a()
As
String
ReDim
a(Len(Text1.Text)
-
1)
As
String
For
i
=
0
To
Len(Text1.Text)
-
1
a(i)
=
Mid(Text1.Text,
i
+
1,
1)
Next
For
i
=
0
To
UBound(a)
Print
a(i)
Next
End
Sub
********************************************************
dim
a()
as
string
redim
a(len(text1.text)-1)
as
string
for
i=0
to
len(text1.text)-1
a(i)=mid(text1.text,i+1,1)
next
补充:不知道你是不是用VB调试的,是不是忘了添加控件,我在知道里的回答绝对是先调试后回答的,如果还是不行,你把下边的******中间的代码复制到文本文件并改名为form1.frm,在代码里加了把a()打印出来的代码
********************************************************
VERSION
5.00
Begin
VB.Form
Form1
Caption
=
"Form1"
ClientHeight
=
3090
ClientLeft
=
60
ClientTop
=
450
ClientWidth
=
4680
LinkTopic
=
"Form1"
ScaleHeight
=
3090
ScaleWidth
=
4680
StartUpPosition
=
3
'窗口缺省
Begin
VB.TextBox
Text1
Height
=
735
Left
=
720
TabIndex
=
1
Text
=
"Text1"
Top
=
1560
Width
=
3135
End
Begin
VB.CommandButton
Command1
Caption
=
"Command1"
Height
=
495
Left
=
1920
TabIndex
=
0
Top
=
360
Width
=
1455
End
End
Attribute
VB_Name
=
"Form1"
Attribute
VB_GlobalNameSpace
=
False
Attribute
VB_Creatable
=
False
Attribute
VB_PredeclaredId
=
True
Attribute
VB_Exposed
=
False
Private
Sub
Command1_Click()
Dim
a()
As
String
ReDim
a(Len(Text1.Text)
-
1)
As
String
For
i
=
0
To
Len(Text1.Text)
-
1
a(i)
=
Mid(Text1.Text,
i
+
1,
1)
Next
For
i
=
0
To
UBound(a)
a(i)
Next
End
Sub
********************************************************
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
楼上的做人要厚道啊
dim a() as string
redim a(len(text1.text)-1) as string
for i=0 to len(text1.text)-1
a(i)=mid(text1.text,i+1,1)
next
补充:不知道你是不是用VB调试的,是不是忘了添加控件,我在知道里的回答绝对是先调试后回答的,如果还是不行,你把下边的******中间的代码复制到文本文件并改名为form1.frm,在代码里加了把a()打印出来的代码
********************************************************
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text1
Height = 735
Left = 720
TabIndex = 1
Text = "Text1"
Top = 1560
Width = 3135
End
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 495
Left = 1920
TabIndex = 0
Top = 360
Width = 1455
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim a() As String
ReDim a(Len(Text1.Text) - 1) As String
For i = 0 To Len(Text1.Text) - 1
a(i) = Mid(Text1.Text, i + 1, 1)
Next
For i = 0 To UBound(a)
Print a(i)
Next
End Sub
********************************************************
dim a() as string
redim a(len(text1.text)-1) as string
for i=0 to len(text1.text)-1
a(i)=mid(text1.text,i+1,1)
next
补充:不知道你是不是用VB调试的,是不是忘了添加控件,我在知道里的回答绝对是先调试后回答的,如果还是不行,你把下边的******中间的代码复制到文本文件并改名为form1.frm,在代码里加了把a()打印出来的代码
********************************************************
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3090
ClientLeft = 60
ClientTop = 450
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 3090
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.TextBox Text1
Height = 735
Left = 720
TabIndex = 1
Text = "Text1"
Top = 1560
Width = 3135
End
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 495
Left = 1920
TabIndex = 0
Top = 360
Width = 1455
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim a() As String
ReDim a(Len(Text1.Text) - 1) As String
For i = 0 To Len(Text1.Text) - 1
a(i) = Mid(Text1.Text, i + 1, 1)
Next
For i = 0 To UBound(a)
Print a(i)
Next
End Sub
********************************************************
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
楼上的做人要厚道啊
dim
a()
as
string
redim
a(len(text1.text)-1)
as
string
for
i=0
to
len(text1.text)-1
a(i)=mid(text1.text,i+1,1)
next
补充:不知道你是不是用VB调试的,是不是忘了添加控件,我在知道里的回答绝对是先调试后回答的,如果还是不行,你把下边的******中间的代码复制到文本文件并改名为form1.frm,在代码里加了把a()打印出来的代码
********************************************************
VERSION
5.00
Begin
VB.Form
Form1
Caption
=
"Form1"
ClientHeight
=
3090
ClientLeft
=
60
ClientTop
=
450
ClientWidth
=
4680
LinkTopic
=
"Form1"
ScaleHeight
=
3090
ScaleWidth
=
4680
StartUpPosition
=
3
'窗口缺省
Begin
VB.TextBox
Text1
Height
=
735
Left
=
720
TabIndex
=
1
Text
=
"Text1"
Top
=
1560
Width
=
3135
End
Begin
VB.CommandButton
Command1
Caption
=
"Command1"
Height
=
495
Left
=
1920
TabIndex
=
0
Top
=
360
Width
=
1455
End
End
Attribute
VB_Name
=
"Form1"
Attribute
VB_GlobalNameSpace
=
False
Attribute
VB_Creatable
=
False
Attribute
VB_PredeclaredId
=
True
Attribute
VB_Exposed
=
False
Private
Sub
Command1_Click()
Dim
a()
As
String
ReDim
a(Len(Text1.Text)
-
1)
As
String
For
i
=
0
To
Len(Text1.Text)
-
1
a(i)
=
Mid(Text1.Text,
i
+
1,
1)
Next
For
i
=
0
To
UBound(a)
Print
a(i)
Next
End
Sub
********************************************************
dim
a()
as
string
redim
a(len(text1.text)-1)
as
string
for
i=0
to
len(text1.text)-1
a(i)=mid(text1.text,i+1,1)
next
补充:不知道你是不是用VB调试的,是不是忘了添加控件,我在知道里的回答绝对是先调试后回答的,如果还是不行,你把下边的******中间的代码复制到文本文件并改名为form1.frm,在代码里加了把a()打印出来的代码
********************************************************
VERSION
5.00
Begin
VB.Form
Form1
Caption
=
"Form1"
ClientHeight
=
3090
ClientLeft
=
60
ClientTop
=
450
ClientWidth
=
4680
LinkTopic
=
"Form1"
ScaleHeight
=
3090
ScaleWidth
=
4680
StartUpPosition
=
3
'窗口缺省
Begin
VB.TextBox
Text1
Height
=
735
Left
=
720
TabIndex
=
1
Text
=
"Text1"
Top
=
1560
Width
=
3135
End
Begin
VB.CommandButton
Command1
Caption
=
"Command1"
Height
=
495
Left
=
1920
TabIndex
=
0
Top
=
360
Width
=
1455
End
End
Attribute
VB_Name
=
"Form1"
Attribute
VB_GlobalNameSpace
=
False
Attribute
VB_Creatable
=
False
Attribute
VB_PredeclaredId
=
True
Attribute
VB_Exposed
=
False
Private
Sub
Command1_Click()
Dim
a()
As
String
ReDim
a(Len(Text1.Text)
-
1)
As
String
For
i
=
0
To
Len(Text1.Text)
-
1
a(i)
=
Mid(Text1.Text,
i
+
1,
1)
Next
For
i
=
0
To
UBound(a)
a(i)
Next
End
Sub
********************************************************
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
同意二楼的说法,一楼什么人
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询