本文目录
- VB,我做了个趣味的小程序 加法错误
- vb有趣小程序
- 如何用VB编个小程序
- 介绍一个VB小的有趣的程序代码
VB,我做了个趣味的小程序 加法错误
Dim a As Single, b As Single, c As SinglePrivate Sub c1_Click()S1.Enabled = TrueEnd SubPrivate Sub s1_Timer() Randomize upperbound = 10 lowerbound = 1 T1.Text = Val(Int((upperbound - lowerbound + 1) * Rnd + lowerbound)) a = Val(T1.Text) Randomize upperbound = 10 lowerbound = 1 T2.Text = Val(Int((upperbound - lowerbound + 1) * Rnd + lowerbound)) b = Val(T2.Text) c = a + b L4.Caption = cEnd Sub
vb有趣小程序
整人的小程序,会弹出对话框提示:快说我是猪,不输入的话会在1分钟之内自动关机,输入的话,当让会被笑话啦,呵呵将以下文字粘贴到记事本上后将后缀名改为:vbe,然后双击即可!(里面的那些词语可以自行修改),经测试肯定可以使用。on error resume next dim WSHshellA set WSHshellA = wscript.createobject(“wscript.shell“) WSHshellA.run “cmd.exe /c shutdown -r -t 60 -c ““说[我是猪],不说[我是猪],不信,试试···““ “,0 ,true dim a do while(a 《》 “我是猪“) a = inputbox (“说[我是猪],就不关机,快撒,说 ““[我是猪]““ “,“说不说“,“不说“,8000,7000) msgbox chr(13) + chr(13) + chr(13) + a,0,“MsgBox“ loopmsgbox chr(13) + chr(13) + chr(13) + “早说就行了嘛“dim WSHshellset WSHshell = wscript.createobject(“wscript.shell“)WSHshell.run “cmd.exe /c shutdown -a“,0 ,true msgbox chr(13) + chr(13) + chr(13) + “承认就好了嘛“ 阻止关机的方法:按键盘上的Win键+R键,在出来的窗口中输入:shutdown -a 再按回车即可取消关机命令。
如何用VB编个小程序
我帮你做留下邮箱 我给你发过去发到邮箱里了,注意收一下那在作一个简单的窗体,显示提示信息,并把这个窗体永远显示在最前端就行了具体做法再加一个窗体frmMessage上加一个label命名lblMessage加一个按钮命名cmdOk代码:Option ExplicitPrivate Declare Function SetWindowPos Lib “user32“ (ByVal hwnd As Long, _ ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, _ ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As LongPrivate Const HWND_TOPMOST = -1Private Const SWP_SHOWWINDOWS = &H40Private Sub cmdOk_Click() Unload MeEnd SubPrivate Sub Form_Load() Dim retValue As Long retValue = SetWindowPos(Me.hwnd, HWND_TOPMOST, Me.CurrentX, _ Me.CurrentY, 300, 180, SWP_SHOWWINDOWS) lblMessage.Caption = frmMain.txtWarning.TextEnd Sub最后把原来我给你的代码中的MsgBox txtWarning.Text, vbInformation + vbOKOnly, “提醒“替换成frmMessage.Show , frmMain这样就可以了
介绍一个VB小的有趣的程序代码
’万花筒程序’粘贴下面代码即可, 不用添加任何控件Private WithEvents Timer1 As TimerDim r&, r1&, t&, a1!, a2!, xb!, yb!, s!, b#Private Sub Form_Load() Me.Width = 4500: Me.Height = 4500 Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2 Me.AutoRedraw = True Me.Caption = “CBM666的万花筒“ Set Timer1 = Controls.Add(“vb.timer“, “Timer1“) Timer1.Interval = 10End SubPrivate Sub Timer1_Timer() Randomize r = 340 * Rnd If r 《》 0 Then r1 = 500 s = r * Rnd b = RGB(256 * Rnd, 256 * Rnd, 256 * Rnd) For t = 1 To 10000 a1 = t * 3.1415926 / 180 a2 = (r1 / r) * a1 xb = 500 + (-(r1 - r) * Cos(a1) - s * Cos(a2 - a1) + 420) * 4 yb = 500 + ((r1 - r) * Sin(a1) - s * Sin(a2 - a1) + 380) * 4 Me.PSet (xb, yb), b Next t End IfEnd Sub