运行以下程序,在文本框Text1中输入一串字符,单击命令按钮command1,程序可把其中连续的大写字母串挑选出来,并写入列表联List1,如附图A-1所示。能不能也把代码贴出来呢,或是把思路告诉我!谢谢啦!!!十分十分紧急。 用VB.net !!!
2 回答
UYOU
TA贡献1878条经验 获得超4个赞
private sub command1_click()
dim i as integer,tmp as string,str as string
str=""
for i =1 to len(text1)
tmp=mid(text1,i,1)
if tmp>="A" and tmp<="Z" then
str=str & tmp
elseif str<>"" then
list1.additem str
str=""
end if
next
end sub
BIG阳
TA贡献1859条经验 获得超6个赞
Private Sub Button1_Click( ByVal sender As System. Object , ByVal e As System.EventArgs) Handles Button1.Click Dim i As Integer , tmp As String , str As String str = "" For i = 1 To Len(TextBox1.Text) tmp = Mid(TextBox1.Text, i, 1) If tmp >= "A" And tmp <= "Z" Then str = str & tmp ElseIf str <> "" Then ListBox1.Items.Add(str) str = "" End If Next If str <> "" Then ListBox1.Items.Add(str) End Sub |
这个是vb.net 的
添加回答
举报
0/150
提交
取消