Visual Basic - BOTON LIMPIAR

Life is soft - evento anual de software empresarial
 
Vista:

BOTON LIMPIAR

Publicado por erikur-raudi (41 intervenciones) el 26/03/2007 17:44:46
Hola a todos.

Tengo una base de datos en access y las -pantallas/ formularios- las hice son visual basic, he aqui mi pregunta.

Quiero que mi formulario se limpie de los datos que escribi cuando le de click al boton guardar y asi seguir capturando informaciòn.

¿Que es lo que debo hacer?

¡ Gracias por su ayuda !
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:BOTON LIMPIAR

Publicado por Vladimir (3 intervenciones) el 26/03/2007 18:33:12
Saludos!

No soy experto en el tema, y quizas mi solucion no sea la mas adecuada.

En el evento click del boton guardar, una vez que ya traspasé los datos a la base de datos, procedo a limpiar los componentes. Por ejemplo, si tienes un textbox llamado "txtNombre", escribo: txtNombre.text = ""

Ademas puedes incorporar variables de control para el boton guardar, para que no ingresen datos null a la base de datos. Suponiendo que el boton se llama "btnSave", escribes lo siguiente: btnSave.enabled = FALSE. No obstante, si lo desarrollas de esta manera, deberas introducir un "if" en el evento change de las cajas de texto. Asi, por ejemplo, cuando ingresen los campos NOMBRE, RUT y EMAIL, el estado del boton queda habilitado con btnSave.enabled = TRUE.

Esto se logra con el siguiente if:

if txtNombre.text<>"" and txtRut.text<>"" and txtEmail<>"" then
btnSave.enabled = TRUE
else
btnSave.enabled = FALSE
end if

Este codigo se deberá insertar en el evento change de todos los componentes.

Espero te sirva mi solución. Saludos!
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:BOTON LIMPIAR

Publicado por erikur raudi (41 intervenciones) el 26/03/2007 23:18:42
Gracias por tu ayuda, te hare saber si funciono el código.

Hasta pronto.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:BOTON LIMPIAR

Publicado por ARMINDO GONZALEZ (1 intervención) el 29/03/2007 02:21:37
buenas noches

Por este medio pido la colaboracion de ustedes para saber como elaborar el boton de borrar en una factura de visual basic.
Queremos saber como es la programacion para limpiar la factura y empezar una nueva.

GRACIAS
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:BOTON LIMPIAR

Publicado por erikur raudi (41 intervenciones) el 02/04/2007 01:21:57
NO ENTIENDO QUE ES LO QUE DESEAS, PORQUE NO LO EXPLICAAS MAS A DETALLE PARA ASI SABER LOS PORMENORES Y TRATAR DE AYUDARTE.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

BORRAR, SALIR, ENTRAR

Publicado por alfredo (1 intervención) el 12/06/2018 18:35:30
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
Private Sub obtenerXY()
    Dim xy0 As New List(Of Double)
    Dim x_a As Double = x
 
    Dim archivo() As String = System.IO.File.ReadAllLines("C:\Users\B3RNa1\Documents\Visual Studio 2015\Projects\ProgramaViscosidadBasicterminado\PorgramaViscosidadBasic\integrales.csv")
    For Each linea As String In archivo
        Dim x0 As String = linea.Split(",")(0)
        Dim y0 As String = linea.Split(",")(1)
        Dim nuevox0 As Double = Convert.ToDouble(x0, System.Globalization.CultureInfo.InvariantCulture)
        Dim nuevoy0 As Double = Convert.ToDouble(y0, System.Globalization.CultureInfo.InvariantCulture)
        If nuevox0 <= x_a Then
            xy0.Add(nuevox0)
            xy0.Add(nuevoy0)
        End If
    Next
    If xy0.Count = 0 Then
        x0 = 0
        y0 = 0
        MsgBox("Aumente la temperatura")
    Else
        x0 = xy0(xy0.Count - 2)
        y0 = xy0(xy0.Count - 1)
    End If
 
    Dim x0encontrado = x0
 
 
    If x0encontrado > 0 And x0encontrado <= 1.95 Then
 
        Dim x1_a As Double = x0encontrado + 0.05
        x1 = x1_a
    Else
        If x0encontrado = 2.0 Then
            Dim x1_a As Double = x0encontrado + 0.1
            x1 = x1_a
        Else
            If x0encontrado = 2.1 And x0encontrado <= 2.15 Then
                Dim x1_a As Double = x0encontrado + 0.05
                x1 = x1_a
            Else
                If x0encontrado >= 2.2 And x0encontrado <= 4.9 Then
                    Dim x1_a As Double = x0encontrado + 0.1
                    x1 = x1_a
                Else
                    If x0encontrado >= 5.0 And x0encontrado <= 9.0 Then
                        Dim x1_a As Double = x0encontrado + 1
                        x1 = x1_a
                    Else
                        If x0encontrado >= 10.0 And x0encontrado <= 18.0 Then
                            Dim x1_a As Double = x0encontrado + 2
                            x1 = x1_a
                        Else
                            If x0encontrado >= 20.0 And x0encontrado <= 35.0 Then
                                Dim x1_a As Double = x0encontrado + 5
                                x1 = x1_a
                            Else
                                If x0encontrado = 40.0 Then
                                    Dim x1_a As Double = x0encontrado + 10
                                    x1 = x1_a
                                Else
                                    If x0encontrado = 50.0 Then
                                        Dim x1_a As Double = x0encontrado + 15
                                        x1 = x1_a
                                    Else
                                        If x0encontrado = 75.0 Then
                                            Dim x1_a As Double = x0encontrado + 25
                                            x1 = x1_a
                                        End If
                                    End If
                                End If
                            End If
                        End If
                    End If
 
                End If
            End If
        End If
    End If
 
    For Each linea As String In archivo
 
        Dim param_x1 = linea.Split(",")(0)
        Dim nuevoy1 = Convert.ToDouble(param_x1, System.Globalization.CultureInfo.InvariantCulture)
        If nuevoy1.Equals(x1) Then
            Dim linea_y1 As String = linea.Split(",")(1)
            Dim y1_a As Double = Convert.ToDouble(linea_y1, System.Globalization.CultureInfo.InvariantCulture)
            y1 = y1_a
        End If
 
    Next
 
 
End Sub



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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
Private Sub button1_Click(sender As Object, e As EventArgs) Handles button1.Click
    txtX0.Text = ""
    txtX1.Text = ""
    txtY0.Text = ""
    txtY1.Text = ""
    textBox5.Text = ""
    textBox6.Text = ""
    textBox7.Text = ""
 
 
    TextBox10.BackColor = Color.White
    TextBox10.ForeColor = Color.Black
    TextBox10.ReadOnly = True
 
    kelvintxt.BackColor = Color.White
    kelvintxt.ForeColor = Color.Black
    kelvintxt.ReadOnly = True
 
 
    If String.IsNullOrEmpty(textBox4.Text) Then
        MsgBox("Debe ingresar una temperatura")
 
 
    Else
        Dim temperatura As Double = Convert.ToDouble(textBox4.Text.ToString(), System.Globalization.CultureInfo.InvariantCulture)
 
        If radioButton1.Checked Then
            celsiusKelvin(temperatura, kelvintxt)
        Else
            If radioButton2.Checked Then
                fahrenheitKelvin(temperatura, kelvintxt)
            Else
                If radioButton3.Checked Then
                    temp = temperatura
                    kelvintxt.Text = Convert.ToString(temp)
                End If
 
            End If
        End If
 
        Dim temperaturaConvertida As Double = Convert.ToDouble(kelvintxt.Text.ToString(), System.Globalization.CultureInfo.InvariantCulture)
 
        If temperatura > 1000 And radioButton3.Checked = True Then
            MsgBox("Debe ingresar una temperatura menor a 1000 grados kelvin")
        Else
            If temperaturaConvertida > 1000 And radioButton1.Checked = True Or radioButton2.Checked = True Then
                MsgBox("La conversión no debe exceder los 1000 grados Kelvin")
            Else
                If textBox1.Text = "" Or textBox2.Text = "" Or textBox3.Text = "" Then
 
                    MsgBox("Debe seleccionar un gas de la tabla")
                Else
                    Dim sigma As Double = Convert.ToDouble(textBox2.Text.ToString(), System.Globalization.CultureInfo.InvariantCulture)
                    sig = sigma
                    elevarSigma()
                    textBox8.Text = Convert.ToString(sig)
                    If TextBox9.Text = "" Then
                        MsgBox("Debe ingresar la presión")
                    Else
                        Dim capturarPresion As Double = Convert.ToDouble(TextBox9.Text)
                        If Not capturarPresion > 0 And capturarPresion <= 10 Then
                            MsgBox("La presión debe ser menor a 10 y mayor a 0")
                        Else
                            validarYConvertirPresion(capturarPresion)
                            If temp > 1000 Then
                                MsgBox("Error, la temperatura debe ser menor a mil")
                                kelvintxt.BackColor = Color.White
                                kelvintxt.ForeColor = Color.Red
                                kelvintxt.ReadOnly = True
                            Else
                                If Convert.ToDouble(TextBox10.Text) < 1 Or Convert.ToDouble(TextBox10.Text) > 10 Then
                                    MsgBox("Error, las atmosferas deben ser mayores a 0 y menores o igual a 10")
                                    TextBox10.BackColor = Color.White
                                    TextBox10.ForeColor = Color.Red
                                    TextBox10.ReadOnly = True
 
 
                                    textBox5.Text = ""
                                    textBox6.Text = ""
                                    textBox7.Text = ""
 
                                    TextBox10.BackColor = Color.White
                                    TextBox10.ForeColor = Color.Black
                                    TextBox10.ReadOnly = True
 
                                    kelvintxt.BackColor = Color.White
                                    kelvintxt.ForeColor = Color.Black
                                    kelvintxt.ReadOnly = True
                                    txtX0.Text = ""
                                    txtX1.Text = ""
                                    txtY0.Text = ""
                                    txtY1.Text = ""
 
                                Else
                                    Dim pesomol As Double = Convert.ToDouble(textBox1.Text.ToString(), System.Globalization.CultureInfo.InvariantCulture)
                                    Dim k_a As Double = Convert.ToDouble(textBox3.Text.ToString(), System.Globalization.CultureInfo.InvariantCulture)
 
                                    pm = pesomol
                                    k = k_a
                                    obtenerX()
                                    textBox5.Text = Convert.ToString(x)
                                    obtenerXY()
                                    If x0 = 0 And y0 = 0 Then
                                        textBox4.Text = ""
                                        textBox5.Text = ""
                                        textBox6.Text = ""
                                        textBox7.Text = ""
                                        TextBox9.Text = ""
                                        TextBox10.Text = ""
                                        TextBox10.BackColor = Color.White
                                        TextBox10.ForeColor = Color.Black
                                        TextBox10.ReadOnly = True
                                        kelvintxt.Text = ""
                                        kelvintxt.BackColor = Color.White
                                        kelvintxt.ForeColor = Color.Black
                                        kelvintxt.ReadOnly = True
                                        txtX0.Text = ""
                                        txtX1.Text = ""
                                        txtY0.Text = ""
                                        txtY1.Text = ""
                                    Else
                                        txtX0.Text = Convert.ToString(x0)
                                        txtX1.Text = Convert.ToString(x1)
                                        txtY0.Text = Convert.ToString(y0)
                                        txtY1.Text = Convert.ToString(y1)
                                        obtenerOmega()
                                        textBox6.Text = Convert.ToString(omeg)
                                        obtenerM()
                                        textBox7.Text = Convert.ToString(resultado)
                                        textBox7.BackColor = Color.White
                                        textBox7.ForeColor = Color.DarkBlue
                                        textBox7.ReadOnly = True
                                    End If
                                End If
                            End If
                        End If
                    End If
                End If
            End If
        End If
    End If
End Sub
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar