* RobIII moest zichzelf even inhouden en een flame inslikken....
Had bijna geschreeuwd dat een integer maar van -32768 tot 32767 ging... Maar het is
.net. Let dus op: In "gewoon" vb is een integer 2 bytes groot, in .net 4 bytes. En een long is dan dus in "gewoon" vb 4 bytes en in vb.net 8 bytes.
Wel moet ik je even erbij zeggen dat een Integer GEEN "breuken" kan bevatten. Ik zou dus gaan voor een Single, Double (en als je het netjes doet een Currency type).
Just my $0.02
/edit/
Heb 'm effe (ter uwer lering) in mekaar geflanst. Toetsen worden afgevangen, waardes worden omgerekend en zelfs de interface is "intelligent"
Copy & Paste dit naar notepad/kladblok en save als frmEuroCalc.frm
Dubbelklik je file et voila!
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
| VERSION 5.00
Begin VB.Form frmEuroCalc
BorderStyle = 1 'Fixed Single
Caption = "Euro Calc"
ClientHeight = 1425
ClientLeft = 45
ClientTop = 330
ClientWidth = 3450
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 1425
ScaleWidth = 3450
StartUpPosition = 3 'Windows Default
Begin VB.Frame Frame2
Caption = "Euro's"
Height = 1215
Left = 1800
TabIndex = 5
Top = 120
Width = 1575
Begin VB.CommandButton cmdEnG
Caption = "<"
Height = 375
Left = 120
TabIndex = 3
TabStop = 0 'False
Top = 720
Width = 1335
End
Begin VB.TextBox txtEuros
Alignment = 1 'Right Justify
Appearance = 0 'Flat
Height = 285
Left = 120
TabIndex = 2
Top = 360
Width = 1335
End
End
Begin VB.Frame Frame1
Caption = "Guldens"
Height = 1215
Left = 120
TabIndex = 4
Top = 120
Width = 1575
Begin VB.CommandButton cmdGnE
Caption = ">"
Default = -1 'True
Height = 375
Left = 120
TabIndex = 1
TabStop = 0 'False
Top = 720
Width = 1335
End
Begin VB.TextBox txtGuldens
Alignment = 1 'Right Justify
Appearance = 0 'Flat
Height = 285
Left = 120
TabIndex = 0
Top = 360
Width = 1335
End
End
End
Attribute VB_Name = "frmEuroCalc"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Const cEuroValue = 2.20371 'Dacht ik ;-)
Private Sub cmdEnG_Click()
txtGuldens.Text = Replace(FormatNumber(ParseCur(txtEuros.Text, 0) * cEuroValue, 2, vbTrue, vbFalse, vbTrue), ",", ".")
End Sub
Private Sub cmdGnE_Click()
txtEuros.Text = Replace(FormatNumber(ParseCur(txtGuldens.Text, 0) / cEuroValue, 2, vbTrue, vbFalse, vbTrue), ",", ".")
End Sub
Private Sub txtGuldens_GotFocus()
cmdGnE.Default = True
Selectbox txtGuldens
End Sub
Private Sub txtEuros_GotFocus()
cmdEnG.Default = True
Selectbox txtEuros
End Sub
Private Sub txtGuldens_KeyPress(KeyAscii As Integer)
KeyAscii = KeyNumbers(KeyAscii)
End Sub
Private Sub txtEuros_KeyPress(KeyAscii As Integer)
KeyAscii = KeyNumbers(KeyAscii)
End Sub
Private Function KeyNumbers(nKeyValue As Integer, Optional sValid As String = "0123456789.") As Integer
KeyNumbers = IIf((nKeyValue > 26) And (InStr(sValid, Chr(nKeyValue)) = 0), 0, nKeyValue)
End Function
Private Function ParseCur(vVal As String, Optional cDefault As Currency = 0) As Currency
On Error GoTo errConv
ParseCur = CCur(Val(vVal))
Exit Function
errConv:
ParseCur = cDefault
End Function
Private Sub Selectbox(ByRef tBox As TextBox)
tBox.SelStart = 0
tBox.SelLength = Len(tBox.Text)
End Sub |
Sorry dat het zo omslachtig moet, maar ik kan effe geen webspace vinden om het formpje op te zetten...
Veel plezier ermee... Enne:
LEER er iets van. Afkijken is makkelijk genoeg!
[
Voor 85% gewijzigd door
RobIII op 08-02-2003 03:20
]
There are only two hard problems in distributed systems: 2. Exactly-once delivery 1. Guaranteed order of messages 2. Exactly-once delivery.
Je eigen tweaker.me redirect
Over mij