Jan
2
VB.NET删除文本框中空行的方法
雪糕先生 2011/01/02 21:42
VB.NET删除文本框TextBox1.Text 中空行的方法:
'删除文本框中空行的方法 晨彦电脑科技 www.btoss.com
Dim Row1, Row2 As Integer
Dim line() As String
Dim ArList As New ArrayList
If Me.TextBox1.Text <> "" Then'当文本框为空时
Row1 = Me.TextBox1.Lines.Length - 1
For i = 0 To Row1
If Me.TextBox1.Lines(i).ToString <> "" Then'当行不为空时
ArList.Add(Trim(Me.TextBox1.Lines(i).ToString))
End If
Next
Row2 = ArList.Count - 1
ReDim line(Row2)
For i = 0 To Row2
line(i) = ArList.Item(i).ToString
Next
Me.TextBox1.Lines = line
End If
原理就是把不为空的调出来,呵呵!
引用
'删除文本框中空行的方法 晨彦电脑科技 www.btoss.com
Dim Row1, Row2 As Integer
Dim line() As String
Dim ArList As New ArrayList
If Me.TextBox1.Text <> "" Then'当文本框为空时
Row1 = Me.TextBox1.Lines.Length - 1
For i = 0 To Row1
If Me.TextBox1.Lines(i).ToString <> "" Then'当行不为空时
ArList.Add(Trim(Me.TextBox1.Lines(i).ToString))
End If
Next
Row2 = ArList.Count - 1
ReDim line(Row2)
For i = 0 To Row2
line(i) = ArList.Item(i).ToString
Next
Me.TextBox1.Lines = line
End If
原理就是把不为空的调出来,呵呵!
Seaice
2011/01/04 20:11
guo果然VB控-.-@
分页: 1/1 1
分类
热门文章
- [46488]五种方法安装Windows...
- [31118]您可能需要与该网络的 in...
- [15800]2012东埔英歌舞
- [15076]开机自动检测网络状态运行程...
- [14528]APMServ一键快速搭建...
- [13753]各种BIOS的设置细解
- [13519]EvaPhone - 无需...
- [13419]Google提供的免费天气...
- [13118]双路由器上网的连接和设置方...
- [12618]雪糕乐园小游戏集2.04版...