Text3.Text = Text3.Text & B(j - 1) 越界
来源:百度知道 编辑:UC知道 时间:2024/06/05 16:35:39
Option Explicit
Dim n As Integer, i As Integer, s As Integer, A(100) As Integer, B() As String, C(100) As String
Private Sub Command1_Click()
s = 0
Dim k As Integer, Same As Boolean
Text3.Text = ""
Text1.Text = Text1.Text
Text2.Text = Text2.Text
Randomize
For i = 1 To Text1.Text
Do
Same = False
A(i) = Int(Rnd * Text2.Text)
For k = 1 To i - 1
If A(i) = A(k) Then Same = True: Exit For
Next k
Loop While Same = True
Next i
showopen.showopen
Open (showopen.FileName) For Input As #1
Dim Lines As String
Dim NextLine As String
Dim n As Integer
Dim j As Integer
Dim t As Integer
Do While Not EOF(1)
ReDim Preserve B(n)
Line Input #1, B(n)
n = n + 1
Loop
For i = 1 To Text1.Text
j = A(i)
'DoEvents '
Text3.Text = Text3.Text & B(j - 1) & vbCrLf
Next i
Close
Dim n As Integer, i As Integer, s As Integer, A(100) As Integer, B() As String, C(100) As String
Private Sub Command1_Click()
s = 0
Dim k As Integer, Same As Boolean
Text3.Text = ""
Text1.Text = Text1.Text
Text2.Text = Text2.Text
Randomize
For i = 1 To Text1.Text
Do
Same = False
A(i) = Int(Rnd * Text2.Text)
For k = 1 To i - 1
If A(i) = A(k) Then Same = True: Exit For
Next k
Loop While Same = True
Next i
showopen.showopen
Open (showopen.FileName) For Input As #1
Dim Lines As String
Dim NextLine As String
Dim n As Integer
Dim j As Integer
Dim t As Integer
Do While Not EOF(1)
ReDim Preserve B(n)
Line Input #1, B(n)
n = n + 1
Loop
For i = 1 To Text1.Text
j = A(i)
'DoEvents '
Text3.Text = Text3.Text & B(j - 1) & vbCrLf
Next i
Close
我想原因可能是出在 Text1.Text 不是数字或为空,还有一种可能,就是数组A(i)中有一个数为0。你检查一下,下标越界时,j的值和对应的A(i)的值,以确定原因。
看到眼花都不知道你的代码到底想干什么,拜托,给点注释吧。
Text3.Text = Str $ Fal(Text1.Text) + Fal(Text2.Text)
!!!vb比较字符串的问题。有三个text,一个按钮,如何在text3中显示text1和text2中文本不同的地方呢?
解释一下tbUserName.Text=value;
VB问题:text1.text=val(text1.text)+val(text2.text)
TextBox1.Text = Mid(TextBox1.Text, 1, Len(TextBox1.Text) - 1)什么意思
te dijo te amo
text1.text=data怎么出不来结果?
delphi中 .sql.text:=是什么意思谢谢!
新概念英语2 试卷text3的答案
什么是 TE