Visual Basic程序設計作業答案_第1頁
Visual Basic程序設計作業答案_第2頁
Visual Basic程序設計作業答案_第3頁
Visual Basic程序設計作業答案_第4頁
Visual Basic程序設計作業答案_第5頁
全文預覽已結束

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領

文檔簡介

1、Visual Basic程序設計作業答案作業2一、選擇題1B 2C 3D 4B 5D 6A 7B 8C 9A 10D 11C 12B 13D 14C 15A 16B 17C 18B 19D 20B二、填空題 1下拉式菜單 彈出式菜單 2打開 另存為 顏色 字體 打印 3文本框 列表框 4Option Base 1 5Call語句 6工程 工程屬性 通用 Form1.Show 708Sub過程的過程名不能返回值,而Function過程能通過過程名返回值9窗體模塊 標準模塊 類模塊10移出內存 無效狀態11(1)2*Cosa*Sina/(2*a) (2) Sqr(s*(s-a)*(s-b)*(s-

2、c) (3) Sin(45*3.14/180)12(1)x=1 And x=C Or a-c0 And b0 Or(a0 And b0)13False14For While Do153三、閱讀下列程序,給出程序運行結果。1程序運行后,單擊窗體,輸出結果為:5050。23 4 3.4 35 * * *四、程序設計題1 Private Sub Command1_Click() Dim x As Single, y As Single x = Val(Text1.Text) If x 100 Then y = x Else If x 200 Then y = 9.5 * x Else If x 30

3、0 Then y = 0.9 * x Else If x 200 If x Mod 3 0 Then Text1.Text = Text1.Text & Str(x) & Chr(13) & Chr(10) End If x = x + 1 LoopEnd Sub 3 Private Sub Form_Click()Print *;Tab(9);3,Tab(18);6;Tab(27);9;Tab(36);12PrintFor I=15 to 18Print I;For j=3 to 12 Step 3Print Tab(3*j);j*I;Next jPrint Next IEnd sub 4P

4、rivate Sub Command1_Click() Unload MeEnd SubPrivate Sub Option1_Click() Text1.Text = 10 * 2End SubPrivate Sub Option2_Click() Text1.Text = 10 / 2End SubPrivate Sub Option3_Click() Text1.Text = 10 + 2End SubPrivate Sub Option4_Click() Text1.Text = 10 - 2End Sub5Private Function Day(n As Integer) Sele

5、ct Case n Case 0 Day = 星期日 & Chr(13) & (Sunday) Case 1 Day = 星期一 & Chr(13) & (Monday) Case 2 Day = 星期二 & Chr(13) & (Tuesday) Case 3 Day = 星期三 & Chr(13) & (Wednesday) Case 4 Day = 星期四 & Chr(13) & (Thursday) Case 5 Day = 星期五 & Chr(13) & (Friday) Case 6 Day = 星期六 & Chr(13) & (Saturday) End SelectEnd Fu

6、nctionPrivate Sub Text1_KeyPress(KeyAscii As Integer) Dim n As Integer n = Val(Text1.Text) If KeyAscii = 13 Then If n = 0 And n 7 Then Label1.Caption = Day(n) Else MsgBox 請輸入06之間的整數! End If End If Text1.SelStart = 0 Text1.SelLength = Len(Text1.Text)End Sub6新建一個工程,在默認的窗體Form1上放置一個Picture控件,然后編寫如下代碼。P

7、rivate Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 2 Then MsgBox You pressed right Button Picture1.MousePointer = vbArrow End IfEnd SubPrivate Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) Picture1.MousePoi

8、nter = vbUpArrowEnd Sub 7 Private Sub Form_Load() List1.AddItem 李敏 List1.AddItem 張華 List1.AddItem 呂曉燁 List1.AddItem 趙巍 List1.AddItem 袁莉 List1.AddItem 王津 List1.AddItem 何小渴 List1.AddItem 崔寧 List1.AddItem 陳曦 List1.AddItem 劉偉楠End SubPrivate Sub Command1_Click() If Text1.Text Then List1.AddItem Text1.Tex

9、t Text1.Text = Else MsgBox 請在文本框中輸入信息! End IfEnd SubPrivate Sub Command2_Click() List1.RemoveItem List1.ListIndexEnd SubPrivate Sub Command3_Click() If Command3.Caption = 修改 Then Text1.Text = List1.Text Text1.SetFocus Command1.Enabled = False Command2.Enabled = False Command3.Caption = 修改確認 Else List1.List(List1.ListIndex) = Text1.Text Command1.Enabled = True Command2.Enabled = True Text1.Text = Co

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
  • 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
  • 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
  • 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論