vb實驗合肥學校
1、vb實驗4-1-3
貼問題,不要寫標題。
不是所有人都知道你這個標題下是什麼問題,
他們會你的問題,只看這個標題也無法回答。
2、vb實驗不會
創建三個TextBox 分別為TextBox1,TextBox2,TextBox3.其中 TextBox1和TextBox2用來輸出最小值和最大值.TextBox3用來顯示產生的中獎號碼
創建一個Button名稱為Button1
復制以下代碼 其中GetWinningNumber是獲取中獎號碼的函數 LowerLimit, UpperLimit為最小值與最大值(如果參數不是整數 將會報錯 並不產生中獎號碼.如果最小值比最大值大 那麼會互換兩者的值),AddData為返回中獎號碼的參數.
Private Sub Command1_Click()
Dim WinningNumber As Integer
If GetWinningNumber(Text1.Text, Text2.Text, WinningNumber) Then Text3.Text = WinningNumber
End Sub
Private Function GetWinningNumber(LowerLimit, UpperLimit, AddData As Integer) As Boolean
Dim ll As Integer, ul As Integer
If IsNumeric(LowerLimit) = False Or IsNumeric(UpperLimit) = False Then
MsgBox "請輸入有效整數!", vbExclamation + vbOKOnly, "錯誤"
GetWinningNumber = False
Exit Function
End If
If InStr(LowerLimit, ".") > 0 Or InStr(UpperLimit, ".") Then
'這里的代碼是當輸入的數據是小數時候的處理方案
'本例中如果輸入的是小數 就報出錯
MsgBox "請輸入有效整數!", vbExclamation + vbOKOnly, "錯誤"
GetWinningNumber = False
Exit Function
End If
ll = CInt(LowerLimit)
ul = CInt(UpperLimit)
Dim tmp As Integer
If ll > ul Then
'當最小值比最大值大的時候 互轉兩者的值
tmp = ll
ll = ul
ul = tmp
End If
'下面的代碼將在最小值與最大值中產生一個隨機數
Randomize
AddData = Int(Rnd * (ul - ll + 1) + ll)
GetWinningNumber = True
End Function
3、vb實驗操作
VB真的是很簡單的了,吧書本上的知識全部仔細看一遍,然後就是上機多操作,至少要做幾套,很多題目都是原題,即便不是原題,也大多相似,反正我當時考的時候覺得不難,不過你要我現在寫我也寫不好了,這個就是判斷,用if then else,考前突擊一下就過了,另外,機試比筆試重要,一定要多做題,多做題,多做題。把自己會的題目寫完就OK了。
4、VB實驗作業,急,馬上要交
a(0)=text1(0),,,,,,a(9)=text1(9)
b=a(0) c=a(0)
for i=0 to 8
if a(i+1)>a(i) then b=a(i+1)
if a(i+1)<a(i) then c=a(i+1)
end for
df=(a(0)+,,,+a(9)-b-c)/8
text2=df
5、各位哥哥姐姐 幫忙寫下VB實驗報告 寫1程序代碼和實驗過程 2結果分析 謝謝拉
.....入門ABC級的習題自己做做唄
打開VB,建立一個工程,在窗體上添加一個文本框textbox1,將文本框的backcolor設置為綠色;添加3個按鈕,分別命名為MsgShow,MsgClear,MsgEnd
然後寫入如下代碼:
Private Sub Form_Load()
Me.Caption = "練習一習題"
End Sub
Private Sub MsgClear_Click()
Text1.Text = ""
End Sub
Private Sub MsgEnd_Click()
Unload Me
End Sub
Private Sub MsgShow_Click()
Text1.Text = "歡迎使用Visual Basic 6.0"
End Sub
6、VB綜合實驗
Dim x As Integer
Private Sub Command1_Click()
x = x + 1
End Sub
Private Sub Command2_Click()
Print x
End Sub
7、vb實驗指導書實驗5-5怎麼做
Private Sub Command1_Click()
Dim delt!, a#, b#, c#
a = InputBox("輸入系數a", , 1)
b = InputBox("輸入系數b", , 3)
c = InputBox("輸入系數c", , 2)
Label2.Caption = "a=" & a & ",b=" & ",c=" & c
delt = b * b - 4 * a * c
If delt >= 0 Then
delt = Sqr(delt)
Label1.Caption = "X1=" & (-b + delt) / 2 / a & vbCrLf & "X2=" & (-b - delt) / 2 / a
Else
Label1.Caption = "無實根"
End If
End Sub
8、合肥小學計算機老師考編,編程語言類主要看什麼書。是VB、C語言???
VB簡單一點,C語言稍難,建議看VB,考試應該都是題庫,買本資料看看就會了
9、求助 vb實驗
1.
Private Sub Command1_Click()
Dim i As Integer, j As Integer
Dim z As String, zz As String
j = 1
zz = ""
For i = 1000 To 5000
z = Trim(Str(i))
If z = StrReverse(z) Then
zz = zz & " " & z
j = j + 1
If j = 10 Then
Print zz
zz = ""
j = 1
End If
End If
Next
If j <> 10 Then Print zz
End Sub
2.
Private Sub Command1_Click()
Dim i As Integer, j As Integer
Dim z As String, zz As String
For i = 65 To 70
z = Chr(i)
zz = ""
For j = 1 To 2 * (i - 65) + 1
zz = zz & " " & z
Next
Print zz
Next
End Sub
10、VB實驗一具體怎麼做
Private Sub Command1_Click()
For i = 1 To 9 Step 2
sm = sm + f(i)
Next
Print sm
End Sub
Function f(n)
If n <= 1 Then
f = 1
Else
f = n * f(n - 1)
End If
End Function
Private Sub Command2_Click()
For i = 1 To 9 Step 2
s sm, i
Next
Print sm
End Sub
Sub s(ByRef sm, ByVal n)
p = 1
For i = 1 To n
p = p * i
Next
sm = sm + p
End Sub