listbox怎么读取TXT文件(VBnet的)?以回车为一行一行地读取
2个回答
展开全部
<script runat="server">
Sub Page_Load
if Not Page.IsPostBack then
dim a as string
Dim fs AsN ewSystem.IO.FileStream("C:\font.txt",IO.FileMode.Open)
Dim sr AsNewSystem.IO.StreamReader(fs)
dim a as string()=split(sr,vbcrlf)
dim mycountries=New ArrayList
for i=0 to UBound(a)
mycountries.Add(b(i))
next
mycountries.TrimToSize()
mycountries.Sort()
rb.DataSource=mycountries
rb.DataBind()
end if
end sub
</script>
<html>
<body>
<form runat="server">
<asp:LISTBOX id="rb" runat="server" />
</form>
</body>
</html>
运行 测试下 纯手写的 有个别小问题 请见谅
Sub Page_Load
if Not Page.IsPostBack then
dim a as string
Dim fs AsN ewSystem.IO.FileStream("C:\font.txt",IO.FileMode.Open)
Dim sr AsNewSystem.IO.StreamReader(fs)
dim a as string()=split(sr,vbcrlf)
dim mycountries=New ArrayList
for i=0 to UBound(a)
mycountries.Add(b(i))
next
mycountries.TrimToSize()
mycountries.Sort()
rb.DataSource=mycountries
rb.DataBind()
end if
end sub
</script>
<html>
<body>
<form runat="server">
<asp:LISTBOX id="rb" runat="server" />
</form>
</body>
</html>
运行 测试下 纯手写的 有个别小问题 请见谅
展开全部
<script
runat="server">
Sub
Page_Load
if
Not
Page.IsPostBack
then
dim
a
as
string
Dim
fs
AsN
ewSystem.IO.FileStream("C:\font.txt",IO.FileMode.Open)
Dim
sr
AsNewSystem.IO.StreamReader(fs)
dim
a
as
string()=split(sr,vbcrlf)
dim
mycountries=New
ArrayList
for
i=0
to
UBound(a)
mycountries.Add(b(i))
next
mycountries.TrimToSize()
mycountries.Sort()
rb.DataSource=mycountries
rb.DataBind()
end
if
end
sub
</script>
<html>
<body>
<form
runat="server">
<asp:LISTBOX
id="rb"
runat="server"
/>
</form>
</body>
</html>
运行
测试下
纯手写的
有个别小问题
请见谅
runat="server">
Sub
Page_Load
if
Not
Page.IsPostBack
then
dim
a
as
string
Dim
fs
AsN
ewSystem.IO.FileStream("C:\font.txt",IO.FileMode.Open)
Dim
sr
AsNewSystem.IO.StreamReader(fs)
dim
a
as
string()=split(sr,vbcrlf)
dim
mycountries=New
ArrayList
for
i=0
to
UBound(a)
mycountries.Add(b(i))
next
mycountries.TrimToSize()
mycountries.Sort()
rb.DataSource=mycountries
rb.DataBind()
end
if
end
sub
</script>
<html>
<body>
<form
runat="server">
<asp:LISTBOX
id="rb"
runat="server"
/>
</form>
</body>
</html>
运行
测试下
纯手写的
有个别小问题
请见谅
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询