CLR: .Net / Mono / Boo / Otros CLR > VB .NET
Algo Sencillo Que No Encuentro El Codigo Correcto
(1/1)
tobon:
el problema que tengo que cuando tengo el siguiente codigo:
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
Dim myForm2 As New Form2
myForm2.Show()
End Sub
y se vuelve a hacer click en el boton se habre otro nuevo form2, quisiera que cuando se hiciera click el boton y ya haya un form2 abierto active el form2 abierto.
gracias por adelantado.
senzao18:
Copia este codigo......
--- Código: Text --- Public Sub Mostrar(ByVal ofrmOpcionDos As Form) 'Validar que el Módulono se encuentre Abierto. nHwnI = FindWindow(vbNullString, ofrmOpcionDos.Text) If Val(nHwnI.ToString) <> 0 Then MsgBox("El modulo está abierto.", MsgBoxStyle.Exclamation, "DPTienda") SetForegroundWindow(nHwnI) Exit Sub End If ofrmOpcionDos.Show() End Sub ' <System.Runtime.InteropServices.DllImport("user32.dll")> _ Private Shared Function FindWindow(ByVal lpClassName As String, ByVal lpWindowName As String) As System.IntPtr End Function ' <System.Runtime.InteropServices.DllImport("user32.dll")> _ Private Shared Function ShowWindow(ByVal hWnd As System.IntPtr, ByVal nCmdShow As Integer) As Integer End Function ' <System.Runtime.InteropServices.DllImport("user32.dll")> _ Public Shared Function SetForegroundWindow(ByVal hWnd As System.IntPtr) As Boolean End Function ' Public ceroIntPtr As New IntPtr(0) ' '
Y para mandar llamar el formulario usa la siguiente forma......
--- Código: Text --- Dim menuClickB As New CatalogoPlazasForm Mostrar(menuClickB)
Navegación
Ir a la versión completa