vb中题目:在文本框text1中输入一串字符,单击ocmmand1时,在label1中显示最大字符

来源:百度知道 编辑:UC知道 时间:2024/05/17 03:48:35
突然遇到的难题,急,看见的网友们!速给我答案!谢谢了哦!

建一个数组,把字符串分割成字符,循环比对,找出asc最大的就是了

private sub command1_click()
max=val(left(text1,1))
for i= 2 to len(text1)
if val(mid(text1,i,1)) > max then max=val(mid(text1,i,1))
next i
end sub

dim a as string
dim b as integer
dim temp as string
a=text1.text
b=len(a)
for i as integer=1 to b
if temp<mid(a,i,1) then
temp=mid(a,i,1)
end if
next
label1.text=temp

Private Sub Command1_Click()
    If Len(Text1.Text) = 0 Then Exit Sub    '如果内容为空则退出
    Dim I       As Long
    Dim MaxAsc  As Long
    Dim TmpAsc  As Long
    MaxAsc = AscW(Left$(Text1.Text, 1))
    If Len(Text1.Text) >&n