vb一些基础有关问题 兄弟门帮下忙
vb一些基础问题 兄弟门帮下忙
1.How do you display a Pop Up menu mnuPopUp on FormA in an application?
A. Form1.mnuPopUp.Show
B. Form1.PopUpMenu "mnuPopUp "
C. Form1.PopUpMenu mnuPopUp
D. Form1.Menu.Show "mnuPopUp "
2.You want to sort the rsLecturer recordset by the Dept field in ascending order. What is the correct way to do this?
A. rsLecturer.Sort "Dept ASC "
B. rsLecturer.Sort = "Dept ASC "
C. rsLecturer.Sort OrderBy(Dept ASC)
D. rsLecturer.Sort = (Dept ASC)
3.Which of the following options can be used to register an ActiveX DLL? (Choose 2)
A. run the component
B. Use Regsvr32.exe
C. Compile the Component
D. Copy the Component to the Windows System Directory
4.一个窗体上有一个居中的标签,程序在运行过程中,窗体改变大小时,如何使标签自动居中?(4分)
5.请按要求写出VB代码(3分)
要求:假设记录集(RecordSet)已经打开,用ADO,记录集名为RS1,记录集中有两个字段分别为ID,Name,请实现查找ID为“11”,Name为“Jimmy”的记录
答案:
6.如何在状态栏或一个标签上显示鼠标单击位置及移动位置?(4分)
7.请用代码实现在用户关闭窗体(Form1)之前弹出对话框提示用户是否要退出,用户可以选Yes or No(3分)
------解决方案--------------------
1, B ?
2, B
3, BD ?
4,
Private Sub Form_Resize()
Label1.Left = Me.Width / 2 - Label1.Width / 2
Me.Refresh
End Sub
5,
rs1.find "[ID]= '11 ' and [name] = 'Jimmy ' "
6
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.Label1.Caption = "Now Mouse is " & X & ": " & Y
End Sub
7:
Private Sub Form_Unload(Cancel As Integer)
If MsgBox( "Are you sure to close? ", vbQuestion + vbYesNo, "Close ") = vbNo Then
Cancel = True
End If
End Sub
------解决方案--------------------
1,C
2,不敢确定
3,B
4,在form_resize()事件中
label.move from1.scalewidth/2,form1.scaleheight/2,width,height
5,select * from rs1 where [ID]= "11 " and [name]= "jimmy "
6,有一个鼠标跟踪的API函数,我忘了,你自己查一下吧
7,private sub FORM_queryunload()
msgbox "要关闭吗 ",vbyesno+vbquestion
end sub
------解决方案--------------------
1:C
2:B
3:B C
4:sub form_resize()
label1.left=(me.width-label1.width)/2
label1.top=(me.height-label1.height)/2
end sub
5:rs1.find "id= '11 ' and name= 'Jimmy ' "
6:用API
7:sub form_unload(cancel as integer)
If MsgBox( "确认退出吗? ", vbYesNo + vbQuestion, "询问 ") = vbYes Then
Cancel = False
Else
Cancel = True
End if
end sub
供参考
1.How do you display a Pop Up menu mnuPopUp on FormA in an application?
A. Form1.mnuPopUp.Show
B. Form1.PopUpMenu "mnuPopUp "
C. Form1.PopUpMenu mnuPopUp
D. Form1.Menu.Show "mnuPopUp "
2.You want to sort the rsLecturer recordset by the Dept field in ascending order. What is the correct way to do this?
A. rsLecturer.Sort "Dept ASC "
B. rsLecturer.Sort = "Dept ASC "
C. rsLecturer.Sort OrderBy(Dept ASC)
D. rsLecturer.Sort = (Dept ASC)
3.Which of the following options can be used to register an ActiveX DLL? (Choose 2)
A. run the component
B. Use Regsvr32.exe
C. Compile the Component
D. Copy the Component to the Windows System Directory
4.一个窗体上有一个居中的标签,程序在运行过程中,窗体改变大小时,如何使标签自动居中?(4分)
5.请按要求写出VB代码(3分)
要求:假设记录集(RecordSet)已经打开,用ADO,记录集名为RS1,记录集中有两个字段分别为ID,Name,请实现查找ID为“11”,Name为“Jimmy”的记录
答案:
6.如何在状态栏或一个标签上显示鼠标单击位置及移动位置?(4分)
7.请用代码实现在用户关闭窗体(Form1)之前弹出对话框提示用户是否要退出,用户可以选Yes or No(3分)
------解决方案--------------------
1, B ?
2, B
3, BD ?
4,
Private Sub Form_Resize()
Label1.Left = Me.Width / 2 - Label1.Width / 2
Me.Refresh
End Sub
5,
rs1.find "[ID]= '11 ' and [name] = 'Jimmy ' "
6
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Me.Label1.Caption = "Now Mouse is " & X & ": " & Y
End Sub
7:
Private Sub Form_Unload(Cancel As Integer)
If MsgBox( "Are you sure to close? ", vbQuestion + vbYesNo, "Close ") = vbNo Then
Cancel = True
End If
End Sub
------解决方案--------------------
1,C
2,不敢确定
3,B
4,在form_resize()事件中
label.move from1.scalewidth/2,form1.scaleheight/2,width,height
5,select * from rs1 where [ID]= "11 " and [name]= "jimmy "
6,有一个鼠标跟踪的API函数,我忘了,你自己查一下吧
7,private sub FORM_queryunload()
msgbox "要关闭吗 ",vbyesno+vbquestion
end sub
------解决方案--------------------
1:C
2:B
3:B C
4:sub form_resize()
label1.left=(me.width-label1.width)/2
label1.top=(me.height-label1.height)/2
end sub
5:rs1.find "id= '11 ' and name= 'Jimmy ' "
6:用API
7:sub form_unload(cancel as integer)
If MsgBox( "确认退出吗? ", vbYesNo + vbQuestion, "询问 ") = vbYes Then
Cancel = False
Else
Cancel = True
End if
end sub
供参考