473,395 Members | 1,471 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Cannot open the form

Hi,

I am using this code to open the form...
---------------------------------------------------------------------------------------
Private frmAddUser as AddUser()
Dim fc As Form
For Each fc In Me.MdiParent.MdiChildren

If fc Is frmAddUser Then

If fc.WindowState = FormWindowState.Minimized Then

fc.WindowState = FormWindowState.Normal

End If

fc.Show()

fc.Focus()

Return

End If

Next

If (frmAddUser Is Nothing) Then

frmAddUser = New AddUser

frmAddUser.MdiParent = Me.MdiParent

frmAddUser.Show()

End If

---------------------------------------------------------------------

When I close the form and try to reopen it does not open the form. It still recognises that frmAddUser exists. How do I kill the instance when I close the form?

Thanks

Vivek

Nov 21 '05 #1
8 1280
Hi,

If the form is already a mdichild try fc.bringtofront instead of
fc.show to reshow the form

http://msdn.microsoft.com/library/de...fronttopic.asp
Ken
--------------------
"Vivek" <vi****@xtra.co.nz> wrote in message
news:eL**************@TK2MSFTNGP10.phx.gbl...
Hi,

I am using this code to open the form...
---------------------------------------------------------------------------------------
Private frmAddUser as AddUser()
Dim fc As Form
For Each fc In Me.MdiParent.MdiChildren
If fc Is frmAddUser Then
If fc.WindowState = FormWindowState.Minimized Then
fc.WindowState = FormWindowState.Normal
End If
fc.Show()
fc.Focus()
Return
End If
Next
If (frmAddUser Is Nothing) Then
frmAddUser = New AddUser
frmAddUser.MdiParent = Me.MdiParent
frmAddUser.Show()
End If
---------------------------------------------------------------------
When I close the form and try to reopen it does not open the form. It still
recognises that frmAddUser exists. How do I kill the instance when I close
the form?
Thanks
Vivek
Nov 21 '05 #2
Sorry but it did not work for me

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:OX*************@TK2MSFTNGP15.phx.gbl...
Hi,

If the form is already a mdichild try fc.bringtofront instead of
fc.show to reshow the form

http://msdn.microsoft.com/library/de...fronttopic.asp
Ken
--------------------
"Vivek" <vi****@xtra.co.nz> wrote in message
news:eL**************@TK2MSFTNGP10.phx.gbl...
Hi,

I am using this code to open the form...
---------------------------------------------------------------------------------------
Private frmAddUser as AddUser()
Dim fc As Form
For Each fc In Me.MdiParent.MdiChildren
If fc Is frmAddUser Then
If fc.WindowState = FormWindowState.Minimized Then
fc.WindowState = FormWindowState.Normal
End If
fc.Show()
fc.Focus()
Return
End If
Next
If (frmAddUser Is Nothing) Then
frmAddUser = New AddUser
frmAddUser.MdiParent = Me.MdiParent
frmAddUser.Show()
End If
---------------------------------------------------------------------
When I close the form and try to reopen it does not open the form. It
still
recognises that frmAddUser exists. How do I kill the instance when I
close
the form?
Thanks
Vivek

Nov 21 '05 #3
Hi, maybe this can help you, I hope the code is clear otherwise feel free to
ask:

Private Sub MenuItem2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles _ MenuItem2.Click
If checkFormOpen = False Then
Dim obj As New Form2
obj.MdiParent = Me
obj.WindowState = FormWindowState.Maximized
obj.Show()
End If
End Sub

Private Function checkFormOpen() As Boolean
Dim objForm As Form
For Each objForm In Me.MdiChildren
If TypeOf objForm Is Form2 Then
objForm.WindowState = FormWindowState.Maximized
objForm.BringToFront()
Return True
End If
Next
Return False
End Function
--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning.

"Vivek" <vi****@xtra.co.nz> schreef in bericht
news:uq**************@TK2MSFTNGP09.phx.gbl...
Sorry but it did not work for me

"Ken Tucker [MVP]" <vb***@bellsouth.net> wrote in message
news:OX*************@TK2MSFTNGP15.phx.gbl...
Hi,

If the form is already a mdichild try fc.bringtofront instead of
fc.show to reshow the form

http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemwindowsformscontrolclassbringtofronttop ic.asp

Ken
--------------------
"Vivek" <vi****@xtra.co.nz> wrote in message
news:eL**************@TK2MSFTNGP10.phx.gbl...
Hi,

I am using this code to open the form...


--------------------------------------------------------------------------

-------------
Private frmAddUser as AddUser()
Dim fc As Form
For Each fc In Me.MdiParent.MdiChildren
If fc Is frmAddUser Then
If fc.WindowState = FormWindowState.Minimized Then
fc.WindowState = FormWindowState.Normal
End If
fc.Show()
fc.Focus()
Return
End If
Next
If (frmAddUser Is Nothing) Then
frmAddUser = New AddUser
frmAddUser.MdiParent = Me.MdiParent
frmAddUser.Show()
End If
---------------------------------------------------------------------
When I close the form and try to reopen it does not open the form. It
still
recognises that frmAddUser exists. How do I kill the instance when I
close
the form?
Thanks
Vivek


Nov 21 '05 #4
Vivek,

Will you please sent next time not in HTML format, and as well in a better
readable way, with all those linespaces it is almost impossible to get a
good idea what you are doing.

Probably is the only thing you want to do something as
\\\
If frmAddUser.isdisposed then
frmAddUser is new AddUser
End if
frmAddUser.show
///
I hope this helps,

Cor

Nov 21 '05 #5
"Vivek" <vi****@xtra.co.nz> schrieb

I am using this code to open the form...
-------------------------------------------------------------
-------------------------- Private frmAddUser as AddUser()
Dim fc As Form
For Each fc In Me.MdiParent.MdiChildren

If fc Is frmAddUser Then

If fc.WindowState = FormWindowState.Minimized Then

fc.WindowState = FormWindowState.Normal

End If

fc.Show()

fc.Focus()

Return

End If

Next

If (frmAddUser Is Nothing) Then

frmAddUser = New AddUser

frmAddUser.MdiParent = Me.MdiParent

frmAddUser.Show()

End If

---------------------------------------------------------------
------

When I close the form and try to reopen it does not open the form. It
still recognises that frmAddUser exists. How do I kill the instance
when I close the form?

You can remove the reference (frmAdduser=nothing) by handling the Closed
event of the form (declare frmadduser withevents or use addhandler to attach
the event handler). BTW, within the first If..Endif block, try
frmAdduser.Activate instead (and maybe .Show additionally because
..Activate is sometimes not enough).
Ar min

Nov 21 '05 #6
Thanks.

I tried this but got an error
Private Sub AddUserToolStripMenuItem_Click_1(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
AddUserToolStripMenuItem.Click
Dim fc As Form

For Each fc In Me.MdiParent.MdiChildren
If fc Is frmAddUser Then

If fc.WindowState = FormWindowState.Minimized Then
fc.WindowState = FormWindowState.Normal
End If
fc.Show()
fc.Focus()
Return
End If
Next

If (frmAddUser.IsDisposed) Then
frmAddUser = New AddUser
frmAddUser.MdiParent = Me.MdiParent
End If

frmAddUser.Show()

End Sub
"Cor Ligthert" <no************@planet.nl> wrote in message
news:ew**************@TK2MSFTNGP12.phx.gbl...
Vivek,

Will you please sent next time not in HTML format, and as well in a better
readable way, with all those linespaces it is almost impossible to get a
good idea what you are doing.

Probably is the only thing you want to do something as
\\\
If frmAddUser.isdisposed then
frmAddUser is new AddUser
End if
frmAddUser.show
///
I hope this helps,

Cor

Nov 21 '05 #7
Vivek,

Tell next time what the error is, that makes it much easier to give an
answer, now it still is a gues. See in line what is probably the solution to
the error.

(This is another approach and basicly the one I take, my sample I showed you
was in the way Herfried does it, which is shorter however remove that again)
I tried this but got an error
Private Sub AddUserToolStripMenuItem_Click_1(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
AddUserToolStripMenuItem.Click
Dim fc As Form

For Each fc In Me.MdiParent.MdiChildren
If fc.Name = "AddUser" Then

Or 'that I never did

If typeof fc Is AddUser Then

If fc.WindowState = FormWindowState.Minimized Then
fc.WindowState = FormWindowState.Normal
End If
fc.Show()
Return
End If
Next

frmAddUser.Show()

I hope this helps,

Cor
Nov 21 '05 #8
"Vivek" <vi****@xtra.co.nz> schrieb
If (frmAddUser.IsDisposed) Then


if frmadduser is nothing orelse frmaduser.isdisposed then
Armin
Nov 21 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Christopher Brandsdal | last post by:
Hi! I get an error when I run my code Is there any other way to get te information from my form? Heres the error I get and the code beneath. Line 120 is market with ''''''''''''Line...
1
by: Matt | last post by:
My problem is when the user click the submit button, it will launch another new window for the request page. I want to confirm we cannot use JavaScript open window functions to open a request page?...
2
by: Yasutaka Ito | last post by:
Hi folks! I have a BaseForm class that inherits System.Windows.Forms.Form. It has a property, whose value I need supplied by the class that inherits it. The BaseForm usees the value supplied...
1
by: Bob | last post by:
I am displaying a form with a datagrid populated from a select of database records which now exceed 12,000 when I select them all. The form displays just fine with all 12,000+ entries but when I...
2
by: Bas Cost Budde | last post by:
I have a form with a Collection variable to store several objects with WithEvents children, to have all controls of a certain type behave alike. This has been working for the last day, since...
1
by: ericvdb | last post by:
Hi all, I'm trying to fill a PDF form with asp.net using the FDF Toolkit. I have a simple form with a textbox and a button. When the button is clicked, the pdf should open with the field filled...
3
by: epearce301 | last post by:
Hi, I have table1 and table2, both are linked, and a query has been run. I created forms that use both just the tables, and then another one using just the query. All of the information is there,...
1
by: teenagelcruise | last post by:
hi, i have a problem with my code which is i cannot update and addnew data into the database but i can delete the data.plz give me an idea.this is my code that i wrote. <html> <head> <meta...
21
by: Mick1000 | last post by:
Hi all, I am new to perl and this forum. I am trying to setup a mailing list subscription functionality for customers to receive a periodic newsletter from me. My perl program grabs the html form...
5
by: Musa via AccessMonster.com | last post by:
I have the following code to Open a form and set the form to the Survey_ID from the first form. I keep get errors like cannot update file --- The Survey_ID is an autonumber. Could this be the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.