Is it possible to type an exponent in a textbox or a label using VB6? I am currenltly using two textboxes, one for the base and the other for the exponent, by using the tabkey to go from textbox 1 to textbox 2.
Add a command button to your form. Set its tabindex property to 1 more than your textbox where the number to be exponened will be entered, and set its default property to "True".
Function Power2(ByVal exponent As Long) As Long
Static res(0 To 31) As Long
Dim i As Long
' Raise 2 to a power
' the exponent must be in the range [0,31] or change the Static Res above.
' rule out errors
If exponent < 0 Or exponent > 31 Then Err.Raise 5
' initialize the array at the first call
If res(0) = 0 Then
res(0) = 1
For i = 1 To 30
res(i) = res(i - 1) * 2
' this is a special case
res(31) = &H80000000
' return the result
Power2 = res(exponent)
Text2.Text = Power2
Private Sub Command1_Click()
'First check to see if an inteher has been added to textbox.
If Text1.Text = "" Then
MsgBox "Please add a number to compute exponent.", vbOKOnly + vbExclamation, "Add Integer"
'Check if data entered is an integer.
ElseIf Not IsNumeric(Text1.Text) Then
MsgBox "Only numbers accepted as an entry.", vbOKOnly + vbExclamation, "Add Integer"
I Developed application in C# with crystal reports and created setup file in third party (Advance) Installer.When i installed my application on client system application is working but ...