Tengo un problemilla con una aplicación que estoy desarrollando en visual basic.net...
Vereis, el tema es que en un momento de la aplicación, al pulsar un botón me lanza un formulario con una serie de campos que al rellenarlos y al llegar al último campo me lanza un segundo formulario en el cual cargo algunos valores del primer formulario... hasta ahí correcto.
El problema viene dado que, cuando llego al final de los campos del primer formulario, he hecho que se me minimize y me muestre el segundo formulario... pero no soy capaz de, cuando acabo de rellenar el segundo formulario, me vuelva a mostrar a tamaño normal el primer formulario que tengo minimizado.
Espero haberme explicado bien. Os pongo código de como está ahora el tema:
1.- Lanza el primer formulario, lo lleno y me lanza el seguno formulario (FSubcomptesT). Correcto:
Código:
2.- Lleno el segundo formulario y en el último campo le doy Enter para que guarde datos (Correcto) y me ponga el primer formulario (FCaixaT) en tamaño normal (NO FUNCIONA!):Private Sub TxtNumero_keypress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TxtNumero.KeyPress If e.KeyChar = ChrW(Keys.Enter) Then e.Handled = True 'SendKeys.Send("{TAB}") Dim num_comptasel As Long Dim strConexion As String Dim objConexion As System.Data.OleDb.OleDbConnection Dim objComando As System.Data.OleDb.OleDbDataAdapter Dim objDS As New DataSet Dim mitabla As DataTable = objDS.Tables.Add("mitabla") num_comptasel = Me.TxtNumero.Text strConexion = "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=C:\caixa\base.mdb" objComando = Nothing objDS = New DataSet objConexion = New System.Data.OleDb.OleDbConnection(strConexion) objComando = New System.Data.OleDb.OleDbDataAdapter("Select * From Comptes where numcompta='" & num_comptasel & "' and tipcaixa='" & Me.CmbTipCaixa.Text & "'", strConexion) objComando.Fill(objDS, "Select * From Comptes where numcompta='" & num_comptasel & "' and tipcaixa='" & Me.CmbTipCaixa.Text & "'") 'Try If objDS.Tables(0).Rows.Count = 0 Then MsgBox("El subcompte no existeix, el vol crear?", MsgBoxStyle.OkCancel, "Atenció") 'Me.Visible = False Me.WindowState = FormWindowState.Minimized Esportiu.FSubcomptesT.Visible = True Esportiu.FSubcomptesT.TxtNumSub.Text = Me.TxtNumero.Text Esportiu.FSubcomptesT.TxtNomSub.Text = "" Esportiu.FSubcomptesT.TxtIva.Text = "" End If End If End Sub
Código:
Agradezco ayuda urgente!! Muchas gracias!!Private Sub TxtIva_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TxtIva.KeyPress Dim tipocaixa As String Dim nom_comptasel As String Select Case e.KeyChar Case ChrW(Keys.Enter) e.Handled = True nom_comptasel = Me.TxtNomSub.Text tipocaixa = Me.CmbCaixa.Text If OptI.Checked = True Then OptI.Tag = 1 Else OptI.Tag = 0 End If Me.ComptesBindingSource.EndEdit() Me.ComptesTableAdapter.Update(Me.BaseDataSet.Comptes) PictureBox2.Visible = True Me.Refresh() System.Threading.Thread.Sleep(1000) PictureBox2.Visible = False Me.Visible = False FCaixaT.Activate() If WindowState = FormWindowState.Normal Then WindowState = FormWindowState.Maximized End If End Select End Sub
Saludos