标题:为什么我这个代码不能换行(VB.NET)
只看楼主
jy02520105
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2006-6-20
 问题点数:0 回复次数:6 
为什么我这个代码不能换行(VB.NET)
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Const n = 20
Dim a(n), i, j, t As Integer
Dim tmpstr As String
Randomize()
tmpstr = "显示排序前A的元素:" & Chr(13) & Chr(10)
For i = 0 To n - 1
a(i) = Int(Rnd() * 90) + 10
tmpstr = tmpstr & a(i) & " "
Next i
TextBox1.Text = tmpstr
For j = 0 To n - 2
For i = 0 To n - 2 - j
If a(i) < a(i + 1) Then
t = a(i)
a(i) = a(i + 1)
a(i + 1) = t
End If
Next i
Next j
tmpstr = "显示排序后A的元素:" & Chr(13) & Chr(10)
For i = 0 To n - 1
tmpstr = tmpstr & a(i) & " "
Next i
TextBox2.Text = tmpstr
For i = 0 To n - 1

Debug.Write(a(20))
Debug.Write(Space(4))
If i Mod 5 = 0 And i <> 0 Then Debug.WriteLine(" ")
Next i
End Sub


我想把这个代码改成4行5列的
但是 For i = 0 To n - 1

Debug.Write(a(20))
Debug.Write(Space(4))
If i Mod 5 = 0 And i <> 0 Then Debug.WriteLine(" ")
Next i
这里好象出错了 帮个忙谢谢
搜索更多相关主题的帖子: NET 代码 
2006-06-20 21:53
adair
Rank: 3Rank: 3
等 级:新手上路
威 望:9
帖 子:250
专家分:0
注 册:2005-9-3
得分:0 
vbcr

********年轻无极限******** 要時刻相信你自己,不要被自己打敗
2006-06-21 08:25
jy02520105
Rank: 1
等 级:新手上路
帖 子:10
专家分:0
注 册:2006-6-20
得分:0 

斑竹 能不能帮我改下 随便问问斑竹大大的QQ是什么

2006-06-21 08:41
tail
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2006-6-19
得分:0 
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Const n = 20
Dim a(n), i, j, t As Integer
Dim tmpstr As String
Randomize()
tmpstr = "显示排序前A的元素:" & Chr(13) & Chr(10)
For i = 0 To n - 1
Static count1 As Integer
count1 += 1
a(i) = Int(Rnd() * 90) + 10
tmpstr = tmpstr & a(i) & " "
If count1 Mod 5 = 0 Then
tmpstr += vbCrLf
End If
Next i
TextBox1.Text = tmpstr
For j = 0 To n - 2
For i = 0 To n - 2 - j
If a(i) < a(i + 1) Then
t = a(i)
a(i) = a(i + 1)
a(i + 1) = t
End If
Next i
Next j
tmpstr = "显示排序后A的元素:" & Chr(13) & Chr(10)
For i = 0 To n - 1
Static count As Integer
count += 1
tmpstr = tmpstr & a(i) & " "
If count Mod 5 = 0 Then
tmpstr += vbCrLf
End If
Next i
TextBox2.Text = tmpstr
End Sub
2006-06-21 11:02
tail
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2006-6-19
得分:0 
呵呵
不知道debug那个怎么用
就只好在tmpstr的格式上下工夫
2006-06-21 11:03
adair
Rank: 3Rank: 3
等 级:新手上路
威 望:9
帖 子:250
专家分:0
注 册:2005-9-3
得分:0 
Debug.WriteLine(" ")
应该只是输入一个空格吧.我没用过DEBUG.不好意思.
不过.有好几个换行的方法.
在字符串上下功夫.如同4楼所说.
还有就是enviroment.newline(不知道拼写是不是对的.)
还有其它的很多方法.有机会我试试DEBUG.

********年轻无极限******** 要時刻相信你自己,不要被自己打敗
2006-06-23 09:26
梓风
Rank: 2
等 级:新手上路
威 望:4
帖 子:181
专家分:0
注 册:2006-10-22
得分:0 
Me.RichTextBox1.Text = "ceshi" &amp; Chr(13) &amp; "ceshi1" &amp; Chr(13)

等待相逢
2006-10-25 11:29



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-73695-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.435973 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved