6. VERSION 5.00
Begin VB.Form Form1
Caption = "Calculadora by marco"
ScaleMode = 1
AutoRedraw = False
FontTransparent = True
BorderStyle = 4 'Fixed ToolWindow
'Icon = n/a
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ClientLeft = 45
ClientTop = 285
ClientWidth = 3975
ClientHeight = 3195
ShowInTaskbar = 0 'False
StartUpPosition = 3 'Windows Default
Begin CommandButton salir
Caption = "Salir"
Left = 2160
Top = 2520
Width = 1695
Height = 495
TabIndex = 11
End
Begin CommandButton new
Caption = "Nuevo calculo"
Left = 120
Top = 2520
7. Width = 1695
Height = 495
TabIndex = 10
End
Begin CommandButton dividir
Caption = "/"
Left = 3240
Top = 1800
Width = 615
Height = 495
TabIndex = 9
BeginProperty Font
Name = "MS Sans Serif"
Size = 13,5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin CommandButton por
Caption = "x"
Left = 2160
Top = 1800
Width = 615
Height = 495
TabIndex = 8
BeginProperty Font
8. Name = "MS Sans Serif"
Size = 13,5
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin CommandButton restar
Caption = "-"
Left = 1200
Top = 1800
Width = 615
Height = 495
TabIndex = 7
BeginProperty Font
Name = "MS Sans Serif"
Size = 13,5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin CommandButton sumar
Caption = "+"
Left = 120
9. Top = 1800
Width = 615
Height = 495
TabIndex = 6
BeginProperty Font
Name = "MS Sans Serif"
Size = 13,5
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin TextBox res
Left = 1680
Top = 1080
Width = 1215
Height = 405
TabIndex = 5
BeginProperty Font
Name = "MS Sans Serif"
Size = 9,75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
10. End
Begin TextBox can2
Left = 1680
Top = 600
Width = 1215
Height = 405
TabIndex = 4
BeginProperty Font
Name = "MS Sans Serif"
Size = 9,75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin TextBox can1
Left = 1680
Top = 120
Width = 1215
Height = 405
TabIndex = 3
BeginProperty Font
Name = "MS Sans Serif"
Size = 9,75
Charset = 0
Weight = 400
Underline = 0 'False
11. Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin Label Label3
Caption = "Resultado"
Left = 240
Top = 1200
Width = 1095
Height = 255
TabIndex = 2
BeginProperty Font
Name = "MS Sans Serif"
Size = 9,75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin Label Label2
Caption = "Cantidad2"
Left = 240
Top = 720
Width = 1095
Height = 615
TabIndex = 1
BeginProperty Font
12. Name = "MS Sans Serif"
Size = 9,75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin Label Label1
Caption = "Cantidad1"
Left = 240
Top = 240
Width = 1215
Height = 495
TabIndex = 0
BeginProperty Font
Name = "MS Sans Serif"
Size = 9,75
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
End
Attribute VB_Name = "Form1"
13.
14. VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 1575
ClientLeft = 60
ClientTop = 450
ClientWidth = 3600
LinkTopic = "Form1"
ScaleHeight = 1575
ScaleWidth = 3600
StartUpPosition = 3 'Windows Default
Begin VB.TextBox Text3
Height = 285
Left = 120
TabIndex = 3
Text = "Text3"
Top = 600
Width = 1455
End
Begin VB.TextBox Text1
Height = 285
Left = 120
TabIndex = 2
Text = "Text1"
Top = 120
Width = 1455
End
Begin VB.CommandButton Command2
Caption = "Command2"
15. Height = 255
Left = 1800
TabIndex = 1
Top = 1200
Width = 1695
End
Begin VB.CommandButton Command1
Caption = "Command1"
Height = 255
Left = 120
TabIndex = 0
Top = 1200
Width = 1455
End
Begin VB.Label Label2
Caption = "Label2"
Height = 255
Left = 1800
TabIndex = 5
Top = 600
Width = 1695
End
Begin VB.Label Label1
Caption = "Label1"
Height = 255
Left = 1800
TabIndex = 4
Top = 120
Width = 1695
16. End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Function IntToBin(ByVal IntegerNumber As Long)
IntNum = IntegerNumber
Do
'Use the Mod operator to get the current binary digit from the
'Integer number
TempValue = IntNum Mod 2
BinValue = CStr(TempValue) + BinValue
'Divide the current number by 2 and get the integer result
IntNum = IntNum 2
Loop Until IntNum = 0
IntToBin = BinValue
End Function
Function BinToInt(ByVal BinaryNumber As String)
'Get the length of the binary string
Length = Len(BinaryNumber)
17. 'Convert each binary digit to its corresponding integer value
'and add the value to the previous sum
'The string is parsed from the right (LSB - Least Significant Bit)
'to the left (MSB - Most Significant Bit)
For x = 1 To Length
TempValue = TempValue + Val(Mid(BinaryNumber, Length - x + 1, 1)) * 2 ^ (x - 1)
Next
BinToInt = TempValue
End Function
Private Sub Command1_Click()
'Text1 contains the integer number. Text2 shows the binary result
Label1.Caption = IntToBin(Val(Text1.Text))
End Sub
Private Sub Command2_Click()
'Text3 contains the binary string. Text4 shows the integer result
Label2.Caption = BinToInt(Text3.Text)
End Sub