求用vb做的資料轉換器。介面如下 我財富值就這麼多了,求大神幫忙,救命啊

時間 2022-03-11 23:25:09

1樓:阿克雷之劍

注意下,我的option button是那控制項陣列,就是把乙個option1複製多3次,總共4個option1,依次是二進位制,八進位制,十進位制,十六進製制。把**複製進**區就ok了。option explicit dim text as string private sub command1_click() '按鍵二進位制的設定option explicit

dim text as string

private sub command1_click() '按鍵二進位制的設定

if option1(0).value = true then

text2.text = val(text1.text)

else

if option1(1).value = true then

text = oct_to_dec(val(text1.text))

text2.text = dec_to_bin(val(text))

elseif option1(2).value = true then

text = text1.text

text2.text = dec_to_bin(val(text))

elseif option1(3).value = true then

text = hex_to_dec(text1.text)

text2.text = dec_to_bin(val(text))

end if

end if

end sub

private sub command2_click() '按鍵八進位制的設定

if option1(1).value = true then

text2.text = val(text1.text)

else

if option1(0).value = true then

text = bin_to_dec(val(text1.text))

text2.text = oct(val(text))

elseif option1(2).value = true then

text = text1.text

text2.text = oct(val(text))

elseif option1(3).value = true then

text = hex_to_dec(text1.text)

text2.text = oct(text)

end if

end if

end sub

private sub command3_click() '按鍵十進位制的設定

if option1(2).value = true then

text2.text = val(text1.text)

else

if option1(0).value = true then

text = bin_to_dec(val(text1.text))

text2.text = text1.text

elseif option1(1).value = true then

text2.text = oct_to_dec(val(text1.text))

elseif option1(3).value = true then

text2.text = hex_to_dec(text1.text)

end if

end if

end sub

private sub command4_click() '按鍵十六進製制的設定

if option1(3).value = true then

text2.text = val(text1.text)

else

if option1(0).value = true then

text = bin_to_dec(val(text1.text))

text2.text = hex(val(text))

elseif option1(1).value = true then

text = oct_to_dec(val(text1.text))

text2.text = hex(val(text))

elseif option1(2).value = true then

text2.text = hex(val(text1.text))

end if

end if

end sub

private function dec_to_bin(dec as long) as long '十進位制轉二進位制

dim i as integer

dim b as string

b = ""

while dec \ 2 > 0 or dec mod 2 <> 0

b = str(dec mod 2) + b

dec = dec \ 2

wend

dec_to_bin = val(b)

end function

private function bin_to_dec(bin as long) as long '二進位制轉十進位制

dim a as string

dim b as long

dim i as integer

a = str(bin)

for i = 1 to len(a)

b = b + val(mid(a, len(a) - (i - 1), 1)) * 2 ^ (i - 1)

next i

bin_to_dec = b

end function

private function oct_to_dec(oct as long) as long '八進位制轉十進位制

dim a as string

dim b as long

dim i as integer

a = str(oct)

for i = 1 to len(a)

b = b + val(mid(a, len(a) - (i - 1), 1)) * 8 ^ (i - 1)

next i

oct_to_dec = b

end function

private function hex_to_dec(hex as string) as long '十六進製制轉十進位制

dim a as string

dim b as long

dim n as string

dim i as integer

a = hex

for i = 1 to len(a)

n = mid(a, len(a) - (i - 1), 1)

select case n

case 1 to 9

n = n

case "a"

n = 10

case "b"

n = 11

case "c"

n = 12

case "d"

n = 13

case "e"

n = 14

case "f"

n = 15

end select

b = b + val(n) * 16 ^ (i - 1)

next i

hex_to_dec = b

end function

2樓:風雪劍無痕

參考一下

要個好的音訊轉換器,求幾個好用的音訊轉換器

好多軟體都可以轉得非常出色,恐怕是你自己裡面的選擇沒有選正確罷了,推薦你使用ulead videostudio,音視都能搞定。請到以下 的漢化版本已經註冊過了。最簡單的東西是千千靜聽,裡面有這個功能,很方便。求幾個好用的音訊轉換器 格式工廠 不管你什麼格式都可以,還可以轉 相當好用,大家給推薦乙個好...

香港轉換插頭,香港用的插頭轉換器應該買什麼型別的?

內地的超市一般都有。香港的超市和街頭一般也有 普通的5元港幣。要買 這種插頭的。 轉換插頭,還是轉換插座?建議你還是買國產的,最好用固定的。轉換插座,因為多用插座存在高風險,線排 插排 轉換插座風險更高,不安全,建設你不要用。不安全有 1 經常抽插會做成接觸位鬆動,接觸不良會產生火花,導至插座損壞。...

求英語閱讀翻譯!!別找那些坑爹的中英文轉換器,完全看不懂

相信未來勇往直前 通過手機打 費用很高,因此很很多采用發簡訊,發簡訊比打手機便宜許多。你可以縮短單詞使其更便宜些。你可以去掉單詞中不重要的字母,用數字代替單詞 2 to,4 for 等 你也可以使用標點 u you等 來表達。手機使用者已經開發了一組符號來表來表達感受。sad peter.zhao ...