|
Página 1 de 1
|
Problemas Recargando Un Formulario
Autor |
Mensaje |
fedefunes
Usuario
Registrado: Agosto 2015
Mensajes: 26
Edad: 47
|
Problemas Recargando Un Formulario
Buen dia gente, soy yo otra vez con un pequeño inconveniente, les comento: hice una aplicacion que tiene tableview con valores que se adquieren previamente de una pantalla anterior, la primera vez que pongo los valores de 10 pero cuando voy de nuevo hacia atras y cambio esos valores principales al volver a la tableview siguen estando los anteriores!!! la unica forma de que carguen nuevamente es cerrando el form y que despues cargue de nuevo, he aqui el problema, en todos los form tengo en la propiedad .close una pantallita de despedida (cabe acotar que tambien lo aprendi de ustedes) y cierra toda la aplicacion. Hay alguna forma de recargar el formulario sin tener que cerrarlo? he probado con form.load y form.refresh pero no paso nada, no se en que le estoy errando, ha! tambien form.activate, el punto es que no quiero cerrar el form (sino termina el programa), quiero volver atras poner nuevos valores y que se actualice la tableview nada mas, alguna ayudita?? Gracias de antemano.
Tengo gambas 3.8, bajo ubuntu 14.4
Federico
|
#1 Lunes, 23 May 2016, 13:52 |
|
|
shordi
Analista Programador
Registrado: Septiembre 2009
Mensajes: 4982
Edad: 64 Ubicación: Albacete
|
Re: Problemas Recargando Un Formulario
Citar: o volver atras poner nuevos valores y que se actualice la tableview
Vamos a ver: Esto no es una página web. No existe algo llamado "volver atrás". Tú utilizaste un modo de rellenar el tableview en algún momento la primera vez. Utilízalo de nuevo y ya está.
Y como siempre te digo: SUBE CÓDIGO, sube el código que usas, el ejemplo, la manera, el fallo, el error lo que sea, pero sube algo.
El que digas Citar: una aplicacion que tiene tableview con valores que se adquieren previamente de una pantalla anterior,
Es no decir nada ¿Cómo que se adquieren?¿te los mandan por correo?¿los rellenas tecleando? ¿Se sacan de un archivo?¿tienes una base de datos?¿dos?
Si quieres que te ayudemos pon las cosas fáciles. No seas pudoroso: SUBE el CÓDIGO, el proyecto, el error. Si no no hay nada que hacer.
Léete lo que Aquí se te cuenta
Saludos
=================== No podemos regresar
|
#2 Lunes, 23 May 2016, 16:41 |
|
|
fedefunes
Usuario
Registrado: Agosto 2015
Mensajes: 26
Edad: 47
|
Re: Problemas Recargando Un Formulario
Hola amigo, tienes mucha razon asi habiendo leido "como hacer preguntas inteligentes" voy a intentar ampliar el tema, el ingreso de los datos los hago mediante este formulario y lo que sigue es su codigo:
Public Sub Form_Open()
'Centra y coloca valores de ejemplo
Me.Center
txtart1.Text = "Tubo Flourecente"
txtcant1.Value = 2
txtpot1.Value = 40
txtpt1.Value = 80
txtusoinvierno1.Value = 5
txtusoresto1.Value = 4
txtconsumoinvierno.Value = 400
txtconsumoresto.Value = 320
End
Public Sub form_Close()
'Muestra despedida
Me.Hide
despedida.Show
End
Public Sub consumos(valor1 As Integer, valor2 As Integer)
'Calcula los consumos controlando que no se pongan valores erróneos
If valor1 <> 0 And valor2 <> 0 Then
If valor1 = txtpt1.Text Then
txtconsumoinvierno.Text = (valor1 * valor2)
If txtpt2.Text <> 0 And txtusoinvierno2.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt2.Text * txtusoinvierno2.Text)
Endif
If txtpt3.Text <> 0 And txtusoinvierno3.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt3.Text * txtusoinvierno3.Text)
Endif
If txtpt4.Text <> 0 And txtusoinvierno4.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt4.Text * txtusoinvierno4.Text)
Endif
If txtpt5.Text <> 0 And txtusoinvierno5.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt5.Text * txtusoinvierno5.Text)
Endif
If txtpt6.Text <> 0 And txtusoinvierno6.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt6.Text * txtusoinvierno6.Text)
Endif
Endif
If valor1 = txtpt2.Text Then
txtconsumoinvierno.Text = (valor1 * valor2)
If txtpt1.Text <> 0 And txtusoinvierno1.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt1.Text * txtusoinvierno1.Text)
Endif
If txtpt3.Text <> 0 And txtusoinvierno3.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt3.Text * txtusoinvierno3.Text)
Endif
If txtpt4.Text <> 0 And txtusoinvierno4.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt4.Text * txtusoinvierno4.Text)
Endif
If txtpt5.Text <> 0 And txtusoinvierno5.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt5.Text * txtusoinvierno5.Text)
Endif
If txtpt6.Text <> 0 And txtusoinvierno6.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt6.Text * txtusoinvierno6.Text)
Endif
Endif
If valor1 = txtpt3.Text Then
txtconsumoinvierno.Text = (valor1 * valor2)
If txtpt1.Text <> 0 And txtusoinvierno1.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt1.Text * txtusoinvierno1.Text)
Endif
If txtpt2.Text <> 0 And txtusoinvierno2.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt2.Text * txtusoinvierno2.Text)
Endif
If txtpt4.Text <> 0 And txtusoinvierno4.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt4.Text * txtusoinvierno4.Text)
Endif
If txtpt5.Text <> 0 And txtusoinvierno5.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt5.Text * txtusoinvierno5.Text)
Endif
If txtpt6.Text <> 0 And txtusoinvierno6.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt6.Text * txtusoinvierno6.Text)
Endif
Endif
If valor1 = txtpt4.Text Then
txtconsumoinvierno.Text = (valor1 * valor2)
If txtpt1.Text <> 0 And txtusoinvierno1.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt1.Text * txtusoinvierno1.Text)
Endif
If txtpt2.Text <> 0 And txtusoinvierno2.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt2.Text * txtusoinvierno2.Text)
Endif
If txtpt3.Text <> 0 And txtusoinvierno3.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt3.Text * txtusoinvierno3.Text)
Endif
If txtpt5.Text <> 0 And txtusoinvierno5.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt5.Text * txtusoinvierno5.Text)
Endif
If txtpt6.Text <> 0 And txtusoinvierno6.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt6.Text * txtusoinvierno6.Text)
Endif
Endif
If valor1 = txtpt5.Text Then
txtconsumoinvierno.Text = (valor1 * valor2)
If txtpt1.Text <> 0 And txtusoinvierno1.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt1.Text * txtusoinvierno1.Text)
Endif
If txtpt2.Text <> 0 And txtusoinvierno2.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt2.Text * txtusoinvierno2.Text)
Endif
If txtpt3.Text <> 0 And txtusoinvierno3.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt3.Text * txtusoinvierno3.Text)
Endif
If txtpt4.Text <> 0 And txtusoinvierno4.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt4.Text * txtusoinvierno4.Text)
Endif
If txtpt6.Text <> 0 And txtusoinvierno6.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt6.Text * txtusoinvierno6.Text)
Endif
Endif
If valor1 = txtpt6.Text Then
txtconsumoinvierno.Text = (valor1 * valor2)
If txtpt1.Text <> 0 And txtusoinvierno1.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt1.Text * txtusoinvierno1.Text)
Endif
If txtpt2.Text <> 0 And txtusoinvierno2.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt2.Text * txtusoinvierno2.Text)
Endif
If txtpt3.Text <> 0 And txtusoinvierno3.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt3.Text * txtusoinvierno3.Text)
Endif
If txtpt4.Text <> 0 And txtusoinvierno4.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt4.Text * txtusoinvierno4.Text)
Endif
If txtpt5.Text <> 0 And txtusoinvierno5.Text <> 0 Then
txtconsumoinvierno.Text = txtconsumoinvierno.Text + (txtpt5.Text * txtusoinvierno5.Text)
Endif
Endif
Endif
End
Public Sub consumosresto(valor1 As Integer, valor2 As Integer)
'Calcula igual que el anterior pero para el resto de los días
If valor1 <> 0 And valor2 <> 0 Then
If valor1 = txtpt1.Text Then
txtconsumoresto.Text = (valor1 * valor2)
If txtpt2.Text <> 0 And txtusoresto2.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt2.Text * txtusoresto2.Text)
Endif
If txtpt3.Text <> 0 And txtusoresto3.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt3.Text * txtusoresto3.Text)
Endif
If txtpt4.Text <> 0 And txtusoresto4.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt4.Text * txtusoresto4.Text)
Endif
If txtpt5.Text <> 0 And txtusoresto5.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt5.Text * txtusoresto5.Text)
Endif
If txtpt6.Text <> 0 And txtusoresto6.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt6.Text * txtusoresto6.Text)
Endif
Endif
If valor1 = txtpt2.Text Then
txtconsumoresto.Text = (valor1 * valor2)
If txtpt1.Text <> 0 And txtusoresto1.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt1.Text * txtusoresto1.Text)
Endif
If txtpt3.Text <> 0 And txtusoresto3.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt3.Text * txtusoresto3.Text)
Endif
If txtpt4.Text <> 0 And txtusoresto4.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt4.Text * txtusoresto4.Text)
Endif
If txtpt5.Text <> 0 And txtusoresto5.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt5.Text * txtusoresto5.Text)
Endif
If txtpt6.Text <> 0 And txtusoresto6.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt6.Text * txtusoresto6.Text)
Endif
Endif
If valor1 = txtpt3.Text Then
txtconsumoresto.Text = (valor1 * valor2)
If txtpt1.Text <> 0 And txtusoresto1.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt1.Text * txtusoresto1.Text)
Endif
If txtpt2.Text <> 0 And txtusoresto2.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt2.Text * txtusoresto2.Text)
Endif
If txtpt4.Text <> 0 And txtusoresto4.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt4.Text * txtusoresto4.Text)
Endif
If txtpt5.Text <> 0 And txtusoresto5.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt5.Text * txtusoresto5.Text)
Endif
If txtpt6.Text <> 0 And txtusoresto6.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt6.Text * txtusoresto6.Text)
Endif
Endif
If valor1 = txtpt4.Text Then
txtconsumoresto.Text = (valor1 * valor2)
If txtpt1.Text <> 0 And txtusoresto1.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt1.Text * txtusoresto1.Text)
Endif
If txtpt2.Text <> 0 And txtusoresto2.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt2.Text * txtusoresto2.Text)
Endif
If txtpt3.Text <> 0 And txtusoresto3.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt3.Text * txtusoresto3.Text)
Endif
If txtpt5.Text <> 0 And txtusoresto5.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt5.Text * txtusoresto5.Text)
Endif
If txtpt6.Text <> 0 And txtusoresto6.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt6.Text * txtusoresto6.Text)
Endif
Endif
If valor1 = txtpt5.Text Then
txtconsumoresto.Text = (valor1 * valor2)
If txtpt1.Text <> 0 And txtusoresto1.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt1.Text * txtusoresto1.Text)
Endif
If txtpt2.Text <> 0 And txtusoresto2.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt2.Text * txtusoresto2.Text)
Endif
If txtpt3.Text <> 0 And txtusoresto3.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt3.Text * txtusoresto3.Text)
Endif
If txtpt4.Text <> 0 And txtusoresto4.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt4.Text * txtusoresto4.Text)
Endif
If txtpt6.Text <> 0 And txtusoresto6.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt6.Text * txtusoresto6.Text)
Endif
Endif
If valor1 = txtpt6.Text Then
txtconsumoresto.Text = (valor1 * valor2)
If txtpt1.Text <> 0 And txtusoresto1.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt1.Text * txtusoresto1.Text)
Endif
If txtpt2.Text <> 0 And txtusoresto2.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt2.Text * txtusoresto2.Text)
Endif
If txtpt3.Text <> 0 And txtusoresto3.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt3.Text * txtusoresto3.Text)
Endif
If txtpt4.Text <> 0 And txtusoresto4.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt4.Text * txtusoresto4.Text)
Endif
If txtpt5.Text <> 0 And txtusoresto5.Text <> 0 Then
txtconsumoresto.Text = txtconsumoresto.Text + (txtpt5.Text * txtusoresto5.Text)
Endif
Endif
Endif
End
Public Sub txtcant1_KeyPress()
'Controla si se presionó la tecla adecuada
If Key.code = Key.Enter Or Key.code = Key.Return Then
If IsNumber(txtcant1.text) Then
txtpot1.SetFocus
Else If IsLetter(txtcant1.Text)
txtcant1.Text = ""
Endif
Endif
End
Public Sub txtart1_KeyPress()
'Controla si se presionó la tecla adecuada
If Key.code = Key.Enter Or Key.code = Key.return Then
txtcant1.SetFocus
Endif
End
Public Sub txtpot1_KeyPress()
'Controla si se presionó la tecla adecuada y realiza operación
If Key.code = Key.Enter Or Key.code = Key.Return Then
If IsNumber(txtpot1.text) Then
txtusoinvierno1.SetFocus
txtpt1.Text = txtcant1.Text * txtpot1.Text
Else If IsLetter(txtpot1.Text)
txtpot1.Text = ""
Endif
Endif
End
Public Sub txtusoinvierno1_KeyPress()
'Controla si se presionó la tecla adecuada
If Key.code = Key.Enter Or Key.code = Key.Return Then
If IsNumber(txtusoinvierno1.text) Then
txtusoresto1.SetFocus
Else If IsLetter(txtusoinvierno1.Text)
txtusoinvierno1.Text = ""
Endif
Endif
End
Public Sub txtusoresto1_KeyPress()
'Controla si se presionó la tecla adecuada y realiza operación
If Key.code = Key.Enter Or Key.code = Key.Return Then
If IsNumber(txtusoresto1.text) Then
txtart2.SetFocus
consumos(txtpt1.Text, txtusoinvierno1.Text)
consumosresto(txtpt1.Text, txtusoresto1.Text)
Else If IsLetter(txtusoresto1.Text)
txtusoresto1.Text = ""
Endif
Endif
End
Public Sub txtusoinvierno2_KeyPress()
'Controla si se presionó la tecla adecuada
If Key.code = Key.Enter Or Key.code = Key.Return Then
If IsNumber(txtusoinvierno2.text) Then
txtusoresto2.SetFocus
Else If IsLetter(txtusoinvierno2.Text)
txtusoinvierno2.Text = ""
Endif
Endif
End
Public Sub txtusoresto2_KeyPress()
'Controla si se presionó la tecla adecuada y realiza operación
If Key.code = Key.Enter Or Key.code = Key.Return Then
If IsNumber(txtusoresto2.text) Then
txtart3.SetFocus
consumos(txtpt2.Text, txtusoinvierno2.Text)
consumosresto(txtpt2.Text, txtusoresto2.Text)
Else If IsLetter(txtusoresto2.Text)
txtusoresto2.Text = ""
Endif
Endif
End
Public Sub txtcant2_KeyPress()
'Controla si se presionó la tecla adecuada
If Key.code = Key.Enter Or Key.code = Key.Return Then
If IsNumber(txtcant2.text) Then
txtpot2.SetFocus
Else If IsLetter(txtcant2.Text)
txtcant2.Text = ""
Endif
Endif
End
Public Sub txtart2_KeyPress()
'Controla si se presionó la tecla adecuada
If Key.code = Key.Enter Or Key.code = Key.return Then
txtcant2.SetFocus
Endif
End
Public Sub txtpot2_KeyPress()
'Controla si se presionó la tecla adecuada y realiza operación
If Key.code = Key.Enter Or Key.code = Key.Return Then
If IsNumber(txtpot2.text) Then
txtusoinvierno2.SetFocus
txtpt2.Text = txtcant2.Text * txtpot2.Text
Else If IsLetter(txtpot2.Text)
txtpot2.Text = ""
Endif
Endif
End
Public Sub txtusoinvierno3_KeyPress()
'Controla si se presionó la tecla adecuada
If Key.code = Key.Enter Or Key.code = Key.Return Then
If IsNumber(txtusoinvierno3.text) Then
txtusoresto3.SetFocus
Else If IsLetter(txtusoinvierno3.Text)
txtusoinvierno3.Text = ""
Endif
Endif
End
Public Sub txtusoresto3_KeyPress()
'Controla si se presionó la tecla adecuada y realiza operación
If Key.code = Key.Enter Or Key.code = Key.Return Then
If IsNumber(txtusoresto3.text) Then
txtart4.SetFocus
consumos(txtpt3.Text, txtusoinvierno3.Text)
consumosresto(txtpt3.Text, txtusoresto3.Text)
Else If IsLetter(txtusoresto3.Text)
txtusoresto3.Text = ""
Endif
Endif
End
Public Sub txtcant3_KeyPress()
'Controla si se presionó la tecla adecuada
If Key.code = Key.Enter Or Key.code = Key.Return Then
If IsNumber(txtcant3.text) Then
txtpot3.SetFocus
Else If IsLetter(txtcant3.Text)
txtcant3.Text = ""
Endif
Endif
End
Public Sub txtart3_KeyPress()
'Controla si se presionó la tecla adecuada
If Key.code = Key.Enter Or Key.code = Key.return Then
txtcant3.SetFocus
Endif
End
Public Sub txtpot3_KeyPress()
'Controla si se presionó la tecla adecuada y realiza operación
If Key.code = Key.Enter Or Key.code = Key.Return Then
If IsNumber(txtpot3.text) Then
txtusoinvierno3.SetFocus
txtpt3.Text = txtcant3.Text * txtpot3.Text
Else If IsLetter(txtpot3.Text)
txtpot3.Text = ""
Endif
Endif
End
Public Sub txtusoinvierno4_KeyPress()
'Controla si se presionó la tecla adecuada
If Key.code = Key.Enter Or Key.code = Key.Return Then
If IsNumber(txtusoinvierno4.text) Then
txtusoresto4.SetFocus
Else If IsLetter(txtusoinvierno4.Text)
txtusoinvierno4.Text = ""
Endif
Endif
End
Public Sub txtusoresto4_KeyPress()
'Controla si se presionó la tecla adecuada y realiza operación
If Key.code = Key.Enter Or Key.code = Key.Return Then
If IsNumber(txtusoresto4.text) Then
txtart5.SetFocus
consumos(txtpt4.Text, txtusoinvierno4.Text)
consumosresto(txtpt4.Text, txtusoresto4.Text)
Else If IsLetter(txtusoresto4.Text)
txtusoresto4.Text = ""
Endif
Endif
End
Public Sub txtcant4_KeyPress()
'Controla si se presionó la tecla adecuada
If Key.code = Key.Enter Or Key.code = Key.Return Then
If IsNumber(txtcant4.text) Then
txtpot4.SetFocus
Else If IsLetter(txtcant4.Text)
txtcant4.Text = ""
Endif
Endif
End
Public Sub txtart4_KeyPress()
'Controla si se presionó la tecla adecuada
If Key.code = Key.Enter Or Key.code = Key.return Then
txtcant4.SetFocus
Endif
End
Public Sub txtpot4_KeyPress()
'Controla si se presionó la tecla adecuada y realiza operación
If Key.code = Key.Enter Or Key.code = Key.Return Then
If IsNumber(txtpot4.text) Then
txtusoinvierno4.SetFocus
txtpt4.Text = txtcant4.Text * txtpot4.Text
Else If IsLetter(txtpot4.Text)
txtpot4.Text = ""
Endif
Endif
End
Public Sub txtusoinvierno5_KeyPress()
If Key.code = Key.Enter Or Key.code = Key.Return Then
If IsNumber(txtusoinvierno5.text) Then
txtusoresto5.SetFocus
Else If IsLetter(txtusoinvierno5.Text)
txtusoinvierno5.Text = ""
Endif
Endif
End
Public Sub txtusoresto5_KeyPress()
'Controla si se presionó la tecla adecuada y realiza operación
If Key.code = Key.Enter Or Key.code = Key.Return Then
If IsNumber(txtusoresto5.text) Then
txtart6.SetFocus
consumos(txtpt5.Text, txtusoinvierno5.Text)
consumosresto(txtpt5.Text, txtusoresto5.Text)
Else If IsLetter(txtusoresto5.Text)
txtusoresto5.Text = ""
Endif
Endif
End
Public Sub txtcant5_KeyPress()
'Controla si se presionó la tecla adecuada
If Key.code = Key.Enter Or Key.code = Key.Return Then
If IsNumber(txtcant5.text) Then
txtpot5.SetFocus
Else If IsLetter(txtcant5.Text)
txtcant5.Text = ""
Endif
Endif
End
Public Sub txtart5_KeyPress()
'Controla si se presionó la tecla adecuada
If Key.code = Key.Enter Or Key.code = Key.return Then
txtcant5.SetFocus
Endif
End
Public Sub txtpot5_KeyPress()
'Controla si se presionó la tecla adecuada
If Key.code = Key.Enter Or Key.code = Key.Return Then
If IsNumber(txtpot5.text) Then
txtusoinvierno5.SetFocus
txtpt5.Text = txtcant5.Text * txtpot5.Text
Else If IsLetter(txtpot5.Text)
txtpot5.Text = ""
Endif
Endif
End
Public Sub txtusoinvierno6_KeyPress()
'Controla si se presionó la tecla adecuada
If Key.code = Key.Enter Or Key.code = Key.Return Then
If IsNumber(txtusoinvierno6.text) Then
txtusoresto6.SetFocus
Else If IsLetter(txtusoinvierno6.Text)
txtusoinvierno6.Text = ""
Endif
Endif
End
Public Sub txtcant6_KeyPress()
'Controla si se presionó la tecla adecuada
If Key.code = Key.Enter Or Key.code = Key.Return Then
If IsNumber(txtcant6.text) Then
txtpot6.SetFocus
Else If IsLetter(txtcant6.Text)
txtcant6.Text = ""
Endif
Endif
End
Public Sub txtart6_KeyPress()
'Controla si se presionó la tecla adecuada
If Key.code = Key.Enter Or Key.code = Key.return Then
txtcant6.SetFocus
Endif
End
Public Sub txtpot6_KeyPress()
'Controla si se presionó la tecla adecuada y realiza operación
If Key.code = Key.Enter Or Key.code = Key.Return Then
If IsNumber(txtpot6.text) Then
txtusoinvierno6.SetFocus
txtpt6.Text = txtcant6.Text * txtpot6.Text
Else If IsLetter(txtpot6.Text)
txtpot6.Text = ""
Endif
Endif
End
Public Sub txtusoresto6_KeyPress()
'Controla si se presionó la tecla adecuada y realiza operación
If Key.code = Key.Enter Or Key.code = Key.Return Then
If IsNumber(txtusoresto6.text) Then
txtart1.SetFocus
consumos(txtpt6.Text, txtusoinvierno6.Text)
consumosresto(txtpt6.Text, txtusoresto6.Text)
Else If IsLetter(txtusoresto6.Text)
txtusoresto6.Text = ""
Endif
Endif
End
Public Sub txtpot1_KeyRelease()
'Controla si se presionó la tecla adecuada y realiza operación
If IsNumber(txtpot1.text) Then
txtpt1.Text = txtcant1.Text * txtpot1.Text
Else If IsLetter(txtpot1.Text)
txtpot1.Text = ""
Endif
letrero()
txtpt1.Value = txtcant1.Value * txtpot1.Value
End
Public Sub txtpot2_KeyRelease()
'Controla si se presionó la tecla adecuada y realiza operación
If IsNumber(txtpot2.text) Then
txtpt2.Text = txtcant2.Text * txtpot2.Text
Else If IsLetter(txtpot2.Text)
txtpot2.Text = ""
Endif
letrero()
txtpt2.Value = txtcant2.Value * txtpot2.Value
End
Public Sub txtpot3_KeyRelease()
'Controla si se presionó la tecla adecuada y realiza operación
If IsNumber(txtpot3.text) Then
txtpt3.Text = txtcant3.Text * txtpot3.Text
Else If IsLetter(txtpot3.Text)
txtpot3.Text = ""
Endif
letrero()
txtpt3.Value = txtcant3.Value * txtpot3.Value
End
Public Sub txtpot4_KeyRelease()
'Controla si se presionó la tecla adecuada y realiza operación
If IsNumber(txtpot4.text) Then
txtpt4.Text = txtcant4.Text * txtpot4.Text
Else If IsLetter(txtpot4.Text)
txtpot4.Text = ""
Endif
letrero()
txtpt4.Value = txtcant4.Value * txtpot4.Value
End
Public Sub txtpot5_KeyRelease()
'Controla si se presionó la tecla adecuada y realiza operación
If IsNumber(txtpot5.text) Then
txtpt5.Text = txtcant5.Text * txtpot5.Text
Else If IsLetter(txtpot5.Text)
txtpot5.Text = ""
Endif
letrero()
txtpt5.Value = txtcant5.Value * txtpot5.Value
End
Public Sub txtpot6_KeyRelease()
'Controla si se presionó la tecla adecuada y realiza operación
If IsNumber(txtpot6.text) Then
txtpt6.Text = txtcant6.Text * txtpot6.Text
Else If IsLetter(txtpot6.Text)
txtpot6.Text = ""
Endif
letrero()
txtpt6.Value = txtcant6.Value * txtpot6.Value
End
Public Sub btnokgasto_Click()
'Cambia los colores del botón segun la necesidad
frmfoto3.Visible = False
frmfoto2.Visible = True
If txtconsumoinvierno.Text <> 0 And txtconsumoresto.Text <> 0 Then
frmfoto2.btngasto.Background = Color.Green
Endif
If txtconsumoinvierno.text = 0 And txtconsumoresto.Text = 0 Then
frmfoto2.btngasto.Background = btnokgasto.Background
Endif
End
Public Sub letrero()
'Si no hay ningún valor escrito pone en cero los consumos
If txtpt1.Text = 0 And txtpt2.Text = 0 And txtpt3.Text = 0 And txtpt4.Text = 0 And txtpt5.Text = 0 And txtpt6.Text = 0 Then
txtconsumoinvierno.Text = 0
txtconsumoresto.Text = 0
Endif
End
Public Sub txtart1_LostFocus()
letrero()
End
Public Sub txtart2_LostFocus()
letrero()
End
Public Sub txtart3_LostFocus()
letrero()
End
Public Sub txtart4_LostFocus()
letrero()
End
Public Sub txtart5_LostFocus()
letrero()
End
Public Sub txtart6_LostFocus()
letrero()
End
Public Sub txtcant1_KeyRelease()
'Calcula
letrero()
txtpt1.Value = txtcant1.Value * txtpot1.Value
End
Public Sub txtcant2_KeyRelease()
'Calcula
letrero()
txtpt2.Value = txtcant2.Value * txtpot2.Value
End
Public Sub txtcant3_KeyRelease()
'Calcula
letrero()
txtpt3.Value = txtcant3.Value * txtpot3.Value
End
Public Sub txtcant4_KeyRelease()
'Calcula
letrero()
txtpt4.Value = txtcant4.Value * txtpot4.Value
End
Public Sub txtcant5_KeyRelease()
'Calcula
letrero()
txtpt5.Value = txtcant5.Value * txtpot5.Value
End
Public Sub txtcant6_KeyRelease()
'Calcula
letrero()
txtpt6.Value = txtcant6.Value * txtpot6.Value
End
Public Sub txtusoinvierno1_KeyRelease()
'Calcula
letrero()
consumos(txtpt1.Text, txtusoinvierno1.Text)
consumosresto(txtpt1.Text, txtusoresto1.Text)
End
Public Sub txtusoinvierno2_KeyRelease()
'Calcula
letrero()
consumos(txtpt2.Text, txtusoinvierno2.Text)
consumosresto(txtpt2.Text, txtusoresto2.Text)
End
Public Sub txtusoinvierno3_KeyRelease()
'Calcula
letrero()
consumos(txtpt3.Text, txtusoinvierno3.Text)
consumosresto(txtpt3.Text, txtusoresto3.Text)
End
Public Sub txtusoinvierno4_KeyRelease()
'Calcula
letrero()
consumos(txtpt4.Text, txtusoinvierno4.Text)
consumosresto(txtpt4.Text, txtusoresto4.Text)
End
Public Sub txtusoinvierno5_KeyRelease()
'Calcula
letrero()
consumos(txtpt5.Text, txtusoinvierno5.Text)
consumosresto(txtpt5.Text, txtusoresto5.Text)
End
Public Sub txtusoinvierno6_KeyRelease()
'Calcula
letrero()
consumos(txtpt6.Text, txtusoinvierno6.Text)
consumosresto(txtpt6.Text, txtusoresto6.Text)
End
Public Sub txtpt1_Change()
'Calcula
consumos(txtpt1.Text, txtusoinvierno1.Text)
consumosresto(txtpt1.Text, txtusoresto1.Text)
End
Public Sub txtpt2_Change()
'Calcula
consumos(txtpt2.Text, txtusoinvierno2.Text)
consumosresto(txtpt2.Text, txtusoresto2.Text)
End
Public Sub txtpt3_Change()
'Calcula
consumos(txtpt3.Text, txtusoinvierno3.Text)
consumosresto(txtpt3.Text, txtusoresto3.Text)
End
Public Sub txtpt4_Change()
'Calcula
consumos(txtpt4.Text, txtusoinvierno4.Text)
consumosresto(txtpt4.Text, txtusoresto4.Text)
End
Public Sub txtpt5_Change()
'Calcula
consumos(txtpt5.Text, txtusoinvierno5.Text)
consumosresto(txtpt5.Text, txtusoresto5.Text)
End
Public Sub txtpt6_Change()
'Calcula
consumos(txtpt6.Text, txtusoinvierno6.Text)
consumosresto(txtpt6.Text, txtusoresto6.Text)
End
Public Sub txtusoresto1_KeyRelease()
'Calcula
consumos(txtpt1.Text, txtusoinvierno1.Text)
consumosresto(txtpt1.Text, txtusoresto1.Text)
End
Public Sub txtusoresto2_KeyRelease()
'Calcula
consumos(txtpt2.Text, txtusoinvierno2.Text)
consumosresto(txtpt2.Text, txtusoresto2.Text)
End
Public Sub txtusoresto3_KeyRelease()
'Calcula
consumos(txtpt3.Text, txtusoinvierno3.Text)
consumosresto(txtpt3.Text, txtusoresto3.Text)
End
Public Sub txtusoresto4_KeyRelease()
'Calcula
consumos(txtpt4.Text, txtusoinvierno4.Text)
consumosresto(txtpt4.Text, txtusoresto4.Text)
End
Public Sub txtusoresto5_KeyRelease()
'Calcula
consumos(txtpt5.Text, txtusoinvierno5.Text)
consumosresto(txtpt5.Text, txtusoresto5.Text)
End
Public Sub txtusoresto6_KeyRelease()
'Calcula
consumos(txtpt6.Text, txtusoinvierno6.Text)
consumosresto(txtpt6.Text, txtusoresto6.Text)
End
los comentarios son para que yo me de cuenta que es lo que hace, por eso son tan escuetos, no es para decirles a uds., ya que seria muy atrevido, al fin y al cabo pueden encontrar solo dos lineas para hacer lo que yo hago en 50 jajajaja
despues pasa a este formulario:
Public Sub Form_Open()
'Centra y pone valores de ejemplo
Me.Center
txtpotenciapanel.Value = 25
txtfactorseguridad.Value = 1.15
txtsingeneracion.value = 4
End
Public Sub form_Close()
'Muestra despedida
Me.Hide
despedida.Show
End
Public Sub hlpgasto_MouseDown()
'Muestra ayuda
Dim controles As Control
controles = hlpgasto
Balloon("En este apartado pondremos las artefactos con \n" & "sus respectivos consumos energéticos", controles)
End
Public Sub hlpeficiencia_MouseDown()
'Muestra ayuda
Dim controles As Control
controles = hlpeficiencia
Balloon("En este apartado pondremos los datos \n" & "de la eficiencia del sistema a colocar", controles)
End
Public Sub hlpbateria_MouseDown()
'Muestra ayuda
Dim controles As Control
controles = hlpbateria
Balloon("En este apartado pondremos la prestación \n" & "del tipo de batería a usar", controles)
End
Public Sub btngasto_Click()
frmfoto2.Visible = False
frmfoto3.Visible = True
End
Public Sub btneficiencia_Click()
frmfoto2.Visible = False
frmfoto4.Visible = True
End
Public Sub btnbateria_Click()
frmfoto2.Visible = False
frmfoto5.Visible = True
End
Public Sub btncalcular_Click()
'Para comprobar que todos los datos se han colocado
If btngasto.background = Color.Green And btneficiencia.background = Color.Green And btnbateria.background = Color.Green And txtpotenciapanel.Value <> 0 And txtfactorseguridad.value <> 0 And txtsingeneracion.value <> 0 Then
frmfoto2.Visible = False
frmfoto6.Visible = True
Else If btngasto.background <> Color.Green Or btneficiencia.background <> Color.Green Or btnbateria.background <> Color.Green Or txtpotenciapanel.Value = 0 Or txtfactorseguridad.value = 0 Or txtsingeneracion.value = 0 Then
Message.Info("Falta colocar algun dato")
Endif
End
Public Sub hlpsingeneracion_MouseDown()
'Muestra ayuda
Dim controles As Control
controles = hlpsingeneracion
Balloon("Cantidad de días en que las baterías no producirán \n" & "energía, ya sea por desuso o mantenimiento", controles)
End
y aca esta el formulario que quiero que vuelva atras sin que se cierre, porque cuando lo hago aparece la despedida que le hice anteriormente:
Public Sub Form_Open()
Dim i As Integer
Dim fila As Integer
Dim columna As Integer
'Centra y da tamaños
Me.Center
tablafoto2.Columns.Count = 4
tablafoto2.Rows.Count = 12
tablafoto2.Columns.Width = 115
'Alineamiento central Gridview
For fila = 0 To 11
For columna = 0 To 3
tablafoto2[fila, columna].Alignment = Align.Center
Next
Next
'Alineamiento titulos gridview
For i = 0 To 3
tablafoto2.Columns[i].Alignment = Align.Center
Next
tablafoto2.Columns[0].Title = "C.E."
tablafoto2.Columns[1].Title = "E.G."
tablafoto2.Columns[2].Title = "F.S."
tablafoto2.Columns[3].Title = "N.P."
tablafoto2.Rows[0].Title = "Enero"
tablafoto2.Rows[1].Title = "Febrero"
tablafoto2.Rows[2].Title = "Marzo"
tablafoto2.Rows[3].Title = "Abril"
tablafoto2.Rows[4].Title = "Mayo"
tablafoto2.Rows[5].Title = "Junio"
tablafoto2.Rows[6].Title = "Julio"
tablafoto2.Rows[7].Title = "Agosto"
tablafoto2.Rows[8].Title = "Septiembre"
tablafoto2.Rows[9].Title = "Octubre"
tablafoto2.Rows[10].Title = "Noviembre"
tablafoto2.Rows[11].Title = "Diciembre"
'Pone los valores de consumo de acuerdo al hemisferio
If CInteger(frmfoto.txtlatitud.Text) <0> 0 Then
tablafoto2[0, 0].Text = frmfoto3.txtconsumoinvierno.Value
tablafoto2[1, 0].Text = frmfoto3.txtconsumoinvierno.Value
tablafoto2[2, 0].Text = frmfoto3.txtconsumoresto.Value
tablafoto2[3, 0].Text = frmfoto3.txtconsumoresto.Value
tablafoto2[4, 0].Text = frmfoto3.txtconsumoresto.Value
tablafoto2[5, 0].Text = frmfoto3.txtconsumoresto.Value
tablafoto2[6, 0].Text = frmfoto3.txtconsumoresto.Value
tablafoto2[7, 0].Text = frmfoto3.txtconsumoresto.Value
tablafoto2[8, 0].Text = frmfoto3.txtconsumoresto.Value
tablafoto2[9, 0].Text = frmfoto3.txtconsumoresto.Value
tablafoto2[10, 0].Text = frmfoto3.txtconsumoresto.Value
tablafoto2[11, 0].Text = frmfoto3.txtconsumoinvierno.Value
Endif
'Pone los valores de la energia generada
For i = 0 To 11
tablafoto2[i, 1].Text = frmfoto6.tablafoto1[i, 3].Text
Next
'Pone el factor seguridad
For i = 0 To 11
tablafoto2[i, 2].Text = frmfoto2.txtfactorseguridad.Value
Next
'Pone el numero de paneles
For i = 0 To 11
tablafoto2[i, 3].Text = Round(tablafoto2[i, 0].Text * tablafoto2[i, 2].Text / tablafoto2[i, 1].Text, -2)
tablafoto2[i, 3].Background = Color.Yellow
Next
End
Public Sub form_Close()
'Muestra despedida
'Me.Hide
'despedida.Show
End
Public Sub hlpce_MouseDown()
'Ayuda
Dim controles As Control
controles = hlpce
Balloon("Consumo Energético", controles)
txtfs1.Visible = False
txtfs2.Visible = False
txtnp1.Visible = False
End
Public Sub hlpeg_MouseDown()
'Ayuda
Dim controles As Control
controles = hlpeg
Balloon("Energía Diaria Generada por cada Panel", controles)
txtfs1.Visible = False
txtfs2.Visible = False
txtnp1.Visible = False
End
Public Sub hlpfs_MouseDown()
'Ayuda
Dim controles As Control
controles = hlpfs
Balloon("Factor de Seguridad", controles)
txtfs2.Text = frmfoto2.txtfactorseguridad.Value
txtfs1.Visible = True
txtfs2.Visible = True
txtnp1.Visible = False
End
Public Sub hlpnp_MouseDown()
'Ayuda
Dim controles As Control
controles = hlpnp
Balloon("Número de Paneles Necesarios", controles)
txtfs1.Visible = False
txtfs2.Visible = False
txtnp1.Visible = True
End
Public Sub btnsiguiente2_MouseDown()
frmfoto7.Visible = False
frmfoto8.Visible = True
End
Public Sub btnatrasfoto2_MouseDown()
frmfoto7.Visible = False
frmfoto6.Visible = True
End
Quiero enviarte el proyecto ejecutable, pero no se como hacerlo por aca, o es mejor todo el proyecto con las imagenes, forms y todo?
La verdad es que ya encontre una solucion al problema, le puse una bandera(boolean) al boton para que cuando se activara no me mande a la despedida, pero creo que puede haber algo mejor jajaja. Perdon si asi no se envia el codigo, voy a probar mandarte mas por un PM a ver si tiene mas opciones para mandar un archivo porque aca no lo encontre. Muchas gracias por el tiempo invertido.
PD: Deben haber mil errores, sepan disculpar, ya voy a aprender
Saludos Federico
|
#3 Miercoles, 25 May 2016, 13:43 |
|
|
shordi
Analista Programador
Registrado: Septiembre 2009
Mensajes: 4982
Edad: 64 Ubicación: Albacete
|
Re: Problemas Recargando Un Formulario
Citar: Quiero enviarte el proyecto ejecutable, pero no se como hacerlo por aca, o es mejor todo el proyecto con las imagenes, forms y todo?
Lo mejor que puedes hacer es enviar el fuente del proyecto, lo generas con el menu Proyecto->Crear->Archivo Fuente eso te crea un pequeño archivo comprimido que puedes adjuntar un mensaje del foro con el botón de "Agregar adjunto".
Ten en cuenta que todo ese código en abstracto, sin poder verlo en funcionamiento es algo difícil de digerir...
Saludos.
=================== No podemos regresar
|
#4 Miercoles, 25 May 2016, 17:57 |
|
|
fedefunes
Usuario
Registrado: Agosto 2015
Mensajes: 26
Edad: 47
|
Re: Problemas Recargando Un Formulario
Muchas gracias por las correcciones, todavia las estoy digeriendo y leyendo bastante, me gustaron, especialmente el menu, buenisimo!!!
Loading.....
Saludos
Federico
|
#5 Viernes, 27 May 2016, 01:37 |
|
|
|
Temas parecidos
Temas parecidos
|
Página 1 de 1
|
Usuarios navegando en este tema: 0 registrados, 0 ocultos y 1 invitado Usuarios registrados conectados: Ninguno
|
No puede crear mensajes No puede responder temas No puede editar sus mensajes No puede borrar sus mensajes No puede votar en encuestas No puede adjuntar archivos Puede descargar archivos No puede publicar eventos en el calendario
|
|
|
|
|