RE:introducir funcion en un textbox y evaluar
gracias por la ayuda
estuve buscando y logre hacerlo bueno el programa cumple el objetivo
usando el componente scriptcontrol q por cierto en mi pc no estaba desactualizada y al inicio no corria(bueno asi me parece), y tube que descargarlo de la pagina de microsotf que es la siguiente direccion:
http://www.microsoft.com/downloads/details.aspx?FamilyId=D7E31492-2595-49E6-8C02-1426FEC693AC&displaylang=en
y bueno el programa q hise se los dejo para que lo vean: quizas se me paso algo, o habria q mejorarlo (de hecho que si podria mejorarlo, pero lo dejo para la gente q recien comienza como yo ):
http://www.4shared.com/file/123146667/6757cd9d/porfinn.html
aca ta el codigo
Private Sub Command1_Click()
Dim script1 As New ScriptControl 'declarando el ScriptControl
Dim A, B, c As String
Dim d As Variant
script1.Language = "VBScript" 'declarando el ScriptControl ya que usa 2 lenguajes, VBscript y JavaScript
If Text2.Text = "" And Text3.Text = "" Then 'para q sean introducidos x,y al momento de ejecurtar
MsgBox "Debes ingresar un dato X o Y", 16, "Por favor" 'mensaje q debe de introducirse al menos una variable x,y
Else
A = UCase(Text1.Text) 'convierte a mayuscula los string declarados antes para q si no haya error en minusculas o mayusculas
B = Replace(A, "X", Text2.Text) 'busca y remplaza en la cadena el valor X mayuscula y lo remplza por text2.text
c = Replace(B, "Y", Text3.Text)
d = script1.Eval(c) 'eval es usado por medio del scriptcontrol
Text4.Text = d
Command2.SetFocus
End If
End Sub
Private Sub Command2_Click()
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text1.SetFocus
End Sub
Private Sub Form_Load()
Text4.Locked = True
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text3.SetFocus
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub Text4_Change()
If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub
gracias a Rolando y Diego ; )