在vb程式設計中設計程式窗體中有文字框

2021-03-07 15:42:57 字數 1742 閱讀 1888

1樓:你猜我猜哇擦猜

option explicitdim s(9) as longprivate sub ***mand1_click()dim i as long

for i = 1 to 9

paixu i

next

text2.text = ""

for i = 0 to 9

text2.text = text2.text & s(i) & ","

next

end sub

private sub form_load()dim i as long

text1 = ""

text2.text = ""

randomize

for i = 0 to 9

s(i) = fix(rnd() * 90 + 10)text1.text = text1.text & s(i) & ","

next

end sub

public sub maxs(a as long, b as long)

dim c as long

if b < a then

c = a

a = b

b = c

end if

end sub

public sub paixu(n as long)dim i as long

doevents

if n < 0 or n > 8 then exit submaxs s(n), s(n + 1)

paixu n - 1

end sub

2樓:寶成局琴

按要求在窗體上新增乙個標籤和乙個文字框以及乙個命令按鈕,雙擊命令按鈕,刪除所有**,複製如下**到程式中

private

sub***mand1_click()

ifval(text1)

mod2=0

then

label1

="偶數"

else

label1

="奇數"

endif

endsub

private

subtext1_keypress(keyasciiasinteger)

'判字元

ifkeyascii

<48or

keyascii

>57then

keyascii=0

'0-9字元之外遮蔽

endsub

若滿意請及時採納,謝謝

vb6.0程式中設計乙個窗體,在窗體上新增乙個標籤和乙個文字框以及乙個命令按鈕,要求文字框中只能

3樓:浪花飄零

按要求在窗體上新增乙個標籤和乙個文字框以及乙個命令按鈕,雙擊命令按鈕,刪除所有**,複製如下**到程式中private sub ***mand1_click()if val(text1) mod 2 = 0 thenlabel1 = "偶數"

else

label1 = "奇數"

end if

end sub

private sub text1_keypress(keyascii as integer) '判字元

if keyascii < 48 or keyascii > 57 then keyascii = 0 '0-9字元之外遮蔽

end sub

若滿意請及時採納,謝謝

vb設計程式,統計1000以內能被7整除的正整數的個數

private sub form click dim n as integer,i as integerfor i 7 to 1000 if i mod 7 0 then n n 1next print n end sub private sub form load dim totali,i as ...

VB程式設計好學嗎,電腦程式設計好學嗎?

程式設計好學,就是要多練習,抱書本不行。主要是就是邏輯,你的邏輯思維很嚴謹,發散型思維很強,就能編出好東西,數學基礎好對程式設計有很大幫助。至於哪門語言,這要看你打算開發哪種型別的。無論開發哪方面,要有很好的程式設計思想。至於用什麼語言來編,拿本書看看再練練就會了。不用把主要精力放到學習具體的某個語...

如何把VB中窗體的text值輸入後顯示在另窗體的text上?煩勞煩勞呀

輸入在form1中的text1中,顯示在form2中的text1中,關鍵 在form2窗體中 text1.text form1.text1.text 畫兩個textbox控制項,form1 畫text1 用於輸入 form2畫text2,用於顯示 private sub text1 change f...