Título: errores ejecucion. grafica de la solucion de la ecuacion de segundo grado. Publicado por: @ron en 17 Junio 2009, 01:52 am este es el libro de donde saque el problema de la solucion grafica a ecuaciones de segundo grado pagina 89.
http://www.tecnun.es/asignaturas/Informat1/ayudainf/aprendainf/VisualBasic6/vbasic60.pdf lo que pasa es que no me sale, cambie los nombres de los controles a como originalmente me salen (command1, picture1,etc,) pero aun asi sigo teniendo problemas, entoncs queria saber si el problema era el mal cambio de nombres que hize yo o no. Tambien cabe mencionar que me marca un error en una, creo q es variable llamada xinc. Ps aversi me pueden ayudar con ese problema. *La imagen del programa viene dentro del libro del *.pdf Citar Option Explicit Dim a, b, c As Double Dim x1, x2, dis, xr, xi As Double Private Sub divisiones(nx As Integer, ny As Integer) Dim i As Integer Dim x, xinc, y, yinc As Single pctBox.DrawWidth = 1 xinc = 20 / (nx - 1) x = -10 For i = 1 To nx pctBox.Line (x, 0)-(x, -1) x = x + xinc Next i yinc = 10 / (ny - 1) y = -5 For i = 1 To ny pctBox.Line (-1, y)-(0, y) y = y + yinc Next i pctBox.DrawWidth = 2 End Sub Private Sub cmdSalir_Click() End End Sub Private Sub Form_Load() pctBox.Scale (-10, 5)-(10, -5) End Sub Private Sub hsbBA_Change() a = 1 b = hsbBA.Value / 10# c = hsbCA.Value / 10# lblBA.Caption = b lblCA.Caption = c dis = b ^ 2 - 4 * a * c If optD2.Value = True Then ’mantener pctBox.AutoRedraw = True Else ’borrar pctBox.AutoRedraw = False pctBox.Cls End If If dis > 0 Then x1 = (-b + Sqr(dis)) / (2 * a) x2 = (-b - Sqr(dis)) / (2 * a) lblX1.Caption = Format(x1, "###0.000") lblX2.Caption = Format(x2, "###0.000") pctBox.PSet (x1, 0), vbRed pctBox.PSet (x2, 0), vbRed ElseIf dis = 0 Then x1 = -b / (2 * a) x2 = x1 lblX1.Caption = Format(x1, "###0.000") lblX2.Caption = "" pctBox.PSet (x1, 0), vbGreen Else xr = -b / (2 * a) xi = Sqr(-dis) / (2 * a) lblX1.Caption = Format(xr, "###0.000") lblX2.Caption = Format(xi, "###0.000") pctBox.PSet (xr, xi), vbBlue pctBox.PSet (xr, -xi), vbBlue End If If optSi = True Then Call divisiones(10, 5) End If End Sub Private Sub hsbCA_Change() a = 1 b = hsbBA.Value / 10# c = hsbCA.Value / 10# lblBA.Caption = b lblCA.Caption = c dis = b ^ 2 - 4 * a * c If optD2.Value = True Then ’mantener pctBox.AutoRedraw = True Else ’borrar pctBox.AutoRedraw = False pctBox.Cls End If If dis > 0 Then x1 = (-b + Sqr(dis)) / (2 * a) x2 = (-b - Sqr(dis)) / (2 * a) lblX1.Caption = Format(x1, "###0.000") lblX2.Caption = Format(x2, "###0.000") pctBox.PSet (x1, 0), vbRed pctBox.PSet (x2, 0), vbRed ElseIf dis = 0 Then x1 = -b / (2 * a) x2 = x1 lblX1.Caption = Format(x1, "###0.000") lblX2.Caption = "" pctBox.PSet (x1, 0), vbGreen Else xr = -b / (2 * a) xi = Sqr(-dis) / (2 * a) lblX1.Caption = Format(xr, "###0.000") lblX2.Caption = Format(xi, "###0.000") pctBox.PSet (xr, xi), vbBlue pctBox.PSet (xr, -xi), vbBlue End If If optSi = True Then Call divisiones(10, 5) End If End Sub Private Sub optD1_Click() pctBox.AutoRedraw = True pctBox.Cls pctBox.DrawWidth = 1 pctBox.Line (-90, 0)-(90, 0), vbBlack pctBox.Line (0, -45)-(0, 45), vbBlack pctBox.DrawWidth = 2 End Sub Private Sub pctBox_Paint() pctBox.AutoRedraw = True pctBox.Line (-90, 0)-(90, 0), vbBlack pctBox.Line (0, -45)-(0, 45), vbBlack pctBox.DrawWidth = 2 End Sub saludos y gracias por su tiempo...! Título: Re: errores ejecucion. grafica de la solucion de la ecuacion de segundo grado. Publicado por: BlackZeroX en 17 Junio 2009, 04:05 am Aquí tienes el Source del Form
Abre un block de notas pega esto guardalo con extensión ".frm" No Hubique bien los controles y demas ok, lo demas es cosa tuya A si y leete un Manual de Visual Basic, por si fuera poco. ¡! Código
|