VB编程——编辑菜单功能

VB编程——编辑菜单功能,第1张

“入文本框中字符串为debctymd,则要首先删除最小字母b,最大字母y,然后打印出dmtced 。”
你这个打印结果很神奇。如下不知能否达到你的要求(未区分大小写混合的情况)
Dim a() As String, m As Integer, s As String, y As String'窗体变量
Private Sub Form_Load()
Form1Caption = "倒序打印"
End Sub
Private Sub Command1_Click()
Dim zfc, sc As String
zfc = Text1Text
s = zfc
m = Len(zfc)
Call px
For i = 1 To m
If InStr(Mid(zfc, i, 1), a(1)) = 0 And InStr(Mid(zfc, i, 1), a(m)) = 0 Then sc = sc + Mid(zfc, i, 1)
Next i
Print "去掉最大最小后:" & sc’本行可以不要或改成text1text=sc传给文本框
s = sc
m = Len(sc)
Call px
Print "倒序排列:" & y
End Sub
Sub px()
ReDim a(m)
y = ""
For x = 1 To m
a(x) = Mid(s, x, 1)
Print a(i);
Next x
For i = 1 To m - 1
For j = i + 1 To m
If a(i) < a(j) Then
t = a(i): a(i) = a(j): a(j) = t
End If
Next j
Next i
For i = 1 To m
y = y + a(i)
Next i
End Sub

先编辑一个普通的菜单,然后用PopupMenu来显示菜单。
给个例子(菜单的标题是“ *** 作",菜单的名称是mnuCtl)
'窗体的MouseDown事件:
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 2 Then

PopupMenu mnuCtl

End If
End Sub


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/13283765.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-07-07
下一篇 2023-07-07

发表评论

登录后才能评论

评论列表(0条)

保存