vb計(jì)算器 簡單程序(包含 進(jìn)制轉(zhuǎn)換 )_百度文庫_第1頁
vb計(jì)算器 簡單程序(包含 進(jìn)制轉(zhuǎn)換 )_百度文庫_第2頁
vb計(jì)算器 簡單程序(包含 進(jìn)制轉(zhuǎn)換 )_百度文庫_第3頁
vb計(jì)算器 簡單程序(包含 進(jìn)制轉(zhuǎn)換 )_百度文庫_第4頁
vb計(jì)算器 簡單程序(包含 進(jìn)制轉(zhuǎn)換 )_百度文庫_第5頁
已閱讀5頁,還剩5頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

1、Option ExplicitDim s1 As Integer, N As Single, r As IntegerPrivate Sub Command1_Click(Index As IntegerText1.Text = Text1.Text & IndexEnd SubCEPrivate Sub Command11_Click(Text1.Text = End SubPrivate Sub Command12_Click(Text1.Text = (Text1.Text 2End SubPrivate Sub Command17_Click(Text1.Text = End SubP

2、rivate Sub Command18_Click(Text1.Text = (Text1.Text 3End SubPrivate Sub Command20_Click(If Text1.Text = ThenMsgBox (ElseText1.Text = Val(Text1.Text * (-1End IfEnd SubPrivate Sub Command21_Click(If InStr(Text1.Text, . ThenMsgBox (ElseText1.Text = Text1 & Chr(46End IfEnd SubPrivate Sub Command23_Click

3、(If N = 1 ThenIf Text1.Text = 0 ThenMsgBox ElseText1 = s1 / Text1.TextEnd IfElseIf N = 2 ThenText1 = s1 * Text1.TextElseIf N = 3 ThenText1 = s1 - Text1.TextElseIf N = 4 ThenText1 = s1 + Text1.TextEnd IfEnd SubPrivate Sub Command24_Click(Text1.Text = 1 / Text1.TextEnd SubPrivate Sub Command25_Click(I

4、ndex As IntegerSelect Case IndexCase 0Text1.Text = Text1.Text & ACase 1Text1.Text = Text1.Text & BCase 2Text1.Text = Text1.Text & CCase 3Text1.Text = Text1.Text & DCase 4Text1.Text = Text1.Text & ECase 5Text1.Text = Text1.Text & FEnd SelectEnd SubPrivate Sub Command4_Click(Index As IntegerSelect Cas

5、e IndexCase 0N = 1s1 = Text1.TextText1.Text = Case 1N = 2s1 = Text1.TextText1.Text = Case 2N = 3s1 = Text1.TextText1.Text = Case 3N = 4s1 = Text1.TextText1.Text = End SelectEnd SubPrivate Sub Command5_Click(Text1.Text = Left(Text1.Text, Len(Text1.Text - 1End SubPrivate Sub Command6_Click(Text1.Text

6、= Sqr(Text1.TextEnd SubPrivate Sub Form_Load(r = 10End SubPrivate Sub Option1_Click(Command25(1.Enabled = TrueCommand25(0.Enabled = TrueCommand25(2.Enabled = TrueCommand25(3.Enabled = TrueCommand25(4.Enabled = TrueCommand25(5.Enabled = TrueCommand1(6.Enabled = TrueCommand1(9.Enabled = TrueCommand1(2

7、.Enabled = TrueCommand1(3.Enabled = TrueCommand1(4.Enabled = TrueCommand1(5.Enabled = TrueCommand1(8.Enabled = TrueCommand1(7.Enabled = TrueIf r = 10 ThenText1.Text = trandec(Val(Text1.Text, 16ElseText1.Text = Two16(Text1.TextEnd Ifr = 16End SubPrivate Sub Option2_Click(Command1(6.Enabled = TrueComm

8、and1(9.Enabled = TrueCommand1(2.Enabled = TrueCommand1(3.Enabled = TrueCommand1(4.Enabled = TrueCommand1(5.Enabled = TrueCommand1(8.Enabled = TrueCommand1(7.Enabled = TrueCommand25(0.Enabled = FalseCommand25(1.Enabled = FalseCommand25(2.Enabled = FalseCommand25(3.Enabled = FalseCommand25(4.Enabled =

9、 FalseCommand25(5.Enabled = FalseText1.Text = Convert(Text1.Text, rr = 10End SubPrivate Sub Option3_Click(Command1(6.Enabled = FalseCommand1(9.Enabled = FalseCommand1(2.Enabled = FalseCommand1(3.Enabled = FalseCommand1(4.Enabled = FalseCommand1(5.Enabled = FalseCommand1(8.Enabled = FalseCommand1(7.E

10、nabled = FalseCommand25(0.Enabled = FalseCommand25(1.Enabled = FalseCommand25(2.Enabled = FalseCommand25(3.Enabled = FalseCommand25(4.Enabled = FalseCommand25(5.Enabled = FalseIf r = 10 ThenText1.Text = trandec(Val(Text1.Text, 2ElseText1.Text = HEX_to_BIN(Text1.TextEnd Ifr = 2End SubPrivate Sub Text

11、1_Change(If Mid(Text1.Text, 1, 1 = . ThenText1.Text = 0 & Text1.TextEnd IfEnd SubPublic Function trandec$(ByVal m%, ByVal r%Dim strdtor$Dim iB%, mr%strdtor = Do While m 0mr = m Mod rm = m rIf mr = 10 Thenstrdtor = Chr(mr - 10 + 65 & strdtorElsestrdtor = mr & strdtorEnd IfLooptrandec = strdtorEnd Fun

12、ctionPublic Function Convert(ByVal S As String, ByVal N As Integer As Double 10Dim L As StringDim r( As StringDim i As IntegerDim j As IntegerL = 0|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z r = Split(L, |For i = 1 To Len(SFor j = 0 To UBound(rIf UCase(Mid(S, i, 1 = r(j Th

13、enConvert = Convert * N + jEnd IfNext jNext iEnd FunctionPrivate Function Two16(ByVal X As String As String Do While Len(X Mod 4 0X = 0 + XLoopDo While Len(X 0Select Case Right(X, 4Case 0000Two16 = 0 + Two16Case 0001Two16 = 1 + Two16Case 0010Two16 = 2 + Two16Case 0011Two16 = 3 + Two16Case 0100Two16

14、= 4 + Two16Case 0101Two16 = 5 + Two16Case 0110Two16 = 6 + Two16Case 0111Two16 = 7 + Two16Case 1000Two16 = 8 + Two16Case 1001Two16 = 9 + Two16Case 1010Two16 = A + Two16Case 1011Two16 = B + Two16Case 1100Two16 = C + Two16Case 1101Two16 = D + Two16Case 1110Two16 = E + Two16Case 1111Two16 = F + Two16End

15、 SelectX = Left(X, Len(X - 4LoopEnd FunctionPublic Function HEX_to_BIN(ByVal Hex As String As StringDim i As LongDim B As StringHex = UCase(HexFor i = 1 To Len(HexSelect Case Mid(Hex, i, 1Case 0: B = B & 0000Case 1: B = B & 0001Case 2: B = B & 0010Case 3: B = B & 0011Case 4: B = B & 0100Case 5: B = B & 0101Case 6: B = B & 0110Case 7: B = B & 0111Case 8: B =

溫馨提示

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

評論

0/150

提交評論