Regarding Form Loading/Closing?
Aug 5, 2009
When my form first loads or when it closes a number of events which I have in my code fire, such as a combo box's selected index changing as it populates. Is there anyway to prevent this from occuring? Currently I use a boolean variable which I set to true/false depending on if the form is loadig or closing and then each of the events first check this value before they fire.
View 7 Replies
ADVERTISEMENT
Mar 6, 2009
I've got 2 forms; form1 and form2.
Button1 is added to form1.
When I click button1, I want to close form1 and open form2.
I tried the following.
me.close
form2.show
Its not working. Form1 gets closed but form2 is not showing up.
When I use the following code
me.hide
form2.show, its working.
But hide will not unload form1 and it will still occupy memory.
View 5 Replies
Aug 29, 2011
I have 2 forms. When a user clicks something on form1, form2 pops up. After user is done with form2 and closes it (where the dataset is updated), I want form1 to "reload" the dataset to reflect changes made in form2.
View 1 Replies
Jun 4, 2010
Dim frm As Form
For Each frm In Forms
Set frm = Nothing
Next frm
The above code is what I used in VB6 to close all forms associated with my programs before my program closed. I have been searching for information on how to make sure all forms are closed when closing a VB2008 program.
I have seen info on using the Project Property Shutdown mode When startup form closes and I currently have this set.
Is this all that is really necessary? Will the garbage disposal close everything else to free up RAM?
Also, if I have several forms open and want to close all from the main form without closing each one individually, what is the best approach? Is there a collection like in VB6, go through the collection, compare it to the name of the main form and close it if it is not the main form?
View 4 Replies
Jan 6, 2009
I need to disable the escape key on loading my program and enable on closing.Although I have searched vb 2008 books and forums I cant find any reference.
View 9 Replies
Apr 27, 2011
I have the following code to close a form which is a child. The problem is that when it closes, it closes the MDI parent too.
Private Sub frmTransaction_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
If ListView1.Items.Count >= 1 Then
[Code]....
View 4 Replies
Feb 8, 2012
Alright, I have a vb6 LEGACY application and new Functionality (Form) written in c#. I have a VB.NET COM Class as a wrapper. I can launch the .NET Form just fine. THe problem I am having is closing the .net form from vb6.
Example:
In VB6, I have something like this:
CODE:
But it does not work becuase frmViewer is Nothing for some reason. how I should close the .NET form that was launched from VB6?
View 8 Replies
Apr 2, 2012
I have a parent form that has a list of items and each item has a unique ID. The user can open one or many of the items in a child form (it is set up in a tabbed MDI), but it can only open one instance of each item at a time.
In the parent form, I was going to make a collection (or something like that, maybe there is a better way) to keep track of which items are open in the child forms. I need to know when each child is closed so that it can be removed from the collection and reopened at a later time. I was thinking that when the child form closes, it somehow does something (like raise an event) that tells the parent form to remove the unique ID from the list of current open child forms.
My questions are, is this a good way to do this and I am pretty sure I would use the form closed event in the child form to update that parent form, but as well, I didn't know if this is the best way of handling it.
If raising the event is a good way, are some examples on how to do it out there? I found some for controls, but not while the form is closing/closed.
View 4 Replies
Aug 26, 2011
Im Using VB 2008. I have MsgBox() statements in all Mouse & Form Click events to TEST & NOTHING FIRES during Form Load when I click on Form or Button Controls !!! The Form Load event contains code for Displaying the Label.Text control many times with changes in the Text to simmulate annimation.
[Code]...
View 7 Replies
Apr 28, 2010
I am working on a project that has the user building scrapbook pages through several different forms. When the user selects something a presses a button I have the information about the selection load to a list box which is on a CheckoutForm. One of the options I have is for the user to save what they have made (this includes the information in the list boxes) and return to a previous form to build another page. I have been trying to use the Me.Close() but it does not save the information and using Me.Hide() displays the wrong elements on the forms.
View 5 Replies
Dec 29, 2010
i have a parent form which is having a grid view. In the KeyDown event of the grid view i am calling a child form. If the user closed the child form, my application should close both the parent form and child form. What i have done is, i declared a boolean in the child form and passed the boolean value to parent. May be the code below will give the picture of what i am trying to do.
Private Sub gvJournalEntryDet_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles gvJournalEntryDet.KeyDown
View 8 Replies
Jun 22, 2010
I have a unique challenge that I just cannot seem to get by...I have a form with a series of listboxes that allows the user to rename items in the listbox (I probably should be using a listview control instead). When the user right-clicks and selects rename from the context menu I show a simple form with two labels & text boxes showing the selected list box item in one textbox...the other is blank waiting for the user to enter a new name. What I'd like to do is when the user closes the rename form, the information is passed back to the calling form and a listbox refresh method is fired to show the changed name. Couple question:
First, is there an easier method to implement the renaming concept in a listbox (probably should be using a list view) i.e., have I overcomplicated things?
View 4 Replies
Jun 11, 2011
I a suppose to when the user closes form1 display a messagebox. The messagebox should ask the user if they are sure. If they click yes let them close the form otherwise do not let them. This is the code I have
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim result As DialogResult
[Code]....
View 6 Replies
May 3, 2010
Form1 is a mdi container. It has a bunch of forms that can load inside of it as mdi children. If I close each open form inside the form1, and then click the red X at the top right, application exits fine.If I click the red X without closing the forms inside I get: An unhandled exception of type 'System.CannotUnloadAppDomainException' occurred in mscorlib.dll
Additional information: Error while unloading appdomain. (Exception from HRESULT: 0x80131015) However I can break from it. How do I get the application to not show that error? What must I do to fix those inside forms or close when the red x is clicked?
View 1 Replies
May 27, 2010
Is there a way that a form returns a value? something like ...
sub main()
Dim task as new TaskForm()
dim res as integer=0
res = task.opendialog()
end sub
View 2 Replies
Mar 15, 2012
i have a form with a listbox. the listbox can be edited (things added/deleted) and when the form is closed i would like the items in the listbox to be saved when the red "x" in the top right corner is clicked
View 3 Replies
Dec 31, 2009
i want to check if a certain form is loaded and if so then close it from another form.
View 3 Replies
Oct 27, 2009
I am having a problem with closing a form which I have inherited I have a form called frmAddForm_Simple, which contains 4 main controls (A Data Grid, A Save Button, A Close Button and a Text Box). The idea around the form is to create a form which could be used for inputting of many different types of data which are all entered in the same way (i.e. to add a new row to a database for [Status] table or [Location] table, all of which contain 2 columns in the database (an [Id] and a [value]). On the form I have a property called _FormChanged, which when the textbox text changes, sets the property to True. I then have the following code on the Close Button:-
Public Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
If _FormChanged Then
If MessageBox.Show("Are you sure you want to close and discard any changes?", "Discard Changes",
[CODE]...
Is opened as a dialog (ShowDialog) and when I go to close the inherited form (by click on btnClose) and answer No to the above MessageBox the form closes anyway. Using the Debugged I have worked out that the following events occur in sequence (all of which runs in the Master Form mentioned above):-
1) btnClose_Click sub Routine runs
2) I answer No to the question do I want to close the form
3) The debugger steps over the Me.Close() line (as expected)
4) The debugger jumps up to the Sub Initialise (where ShowDialog was called from) and closes the form.
So at no point has the debugger even ran a line of code which reads Me.Close(), but the form closes anyway so Im fairly confused as to why the form should close.
My Master Form (frmAddForm_Simple) Code:-
Public Class frmAddForm_Simple
Private _FormChanged As Boolean = False
Private _FormLoading As Boolean = False
[CODE].............................
View 1 Replies
Sep 13, 2011
I am trying to close Form1 and then open Form2, but when i do it closes the whole program.I have tried to just hide Form1, but then i can't close the program and I have tried this method too but could not get it to work?
View 2 Replies
Jan 7, 2009
if there is a way that you can close a form and reopen it. The reason is because I have created a tic tac toe game, but at the end I want them to be able to play again. The problem is that if I want them to start over I would have to set alot of stuff back to 0 and or change the buttons on the screen etc. Is there a simple way to just close the form and have it reopen?
View 2 Replies
Mar 6, 2011
I'm working on an application that opens different mdi child forms to do different things whit the data from an Access database. For example I have a form that searches an item in the data base. The other form shows the items details or history. All database communication is handled by data-manager classes. Each whit it own instance of the class. The child forms have no connection to each other (passing of the item is by global variable object).The error occurs after the formclosed event from the closing form.The same error occurs when I open the form one by one.When I have two different child's open and I close one I get this error message: System.InvalidOperationException was unhandled. In a no source Available window.to open the two child forms (from a menu in the mdi parent) a use this code:[code]
View 2 Replies
Dec 5, 2011
I have form1 and form2 and have when a user clicks on an icon on form1 it shows form2 and hides form1. But how would I get it to when a user closes form2 it will show form1 again?
View 3 Replies
Jul 8, 2009
[Code] when the program is launched normally it works fine but when the program is passed the appropriate command line my program responds accordingly except for the fact that the first form does not hide() when told to. its like the program just skips that line and shows the recovery form.
View 2 Replies
Nov 6, 2009
In my one form I have a cancel button whcih is supposed to the form when the button is clicked. But its not closing the form. What could be possible reasons. I am using VS2008.Net3.5
The code is:
Private Sub cbCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cbCancel.Click
[code].....
View 7 Replies
Feb 24, 2012
I have a form in a Pocket PC app that is set to be the Application form using:Application.Run(New frmMain())Somehow this form is getting closed for no reason while working on another form. No closing event is fired and nowhere in my code can you close the main form anyway. It is only closed by clicking the OK button at the top right of the window. When this is clicked, the user is prompted if he/she really wants to close the application. However, this is not occurring either.Basically, I am on another form which adds a new record to the database. After adding the record the gotFocus event is somehow called for frmMain. When the code in the gotFocus event reaches a reference to a control on the form, there is an exception that states that the object is disposed.
View 1 Replies
Jun 28, 2010
I have a test app driven by bluetooth serial events In my form load code I hide the cursor so it doesn't get in the way of pictures (fullscreen)When one event is called by bluetooth, it brings up a msgbox and the user has to click OK. I tried Windows.Forms.Cursor.Show() but it doesn't work.
I'm guessing it's something to do with delegates and events and the form, but the debugger doesn't complain at any point. It just refuses to show the cursor.How can I get my serialport event to show the cursor? And then hide it after?
View 1 Replies
Feb 14, 2010
When my program runs it closes form1 after a few seconds. Depending on what happened during form1's lifespan I may want to open form2. Normally I would just make a new instance of form2 and use the show() method. But form2 is then a child of form1 and then also closes.
View 3 Replies
May 9, 2010
I am looking for guidance regarding a form I am popping up where people have to fill in some information. When something is empty the form shouldnt disappear.
I tried doing this with a showDialog. but when I check the onclick button event the a messagebox come up and show the error/message but then when ok is clicked the form is closed.
View 2 Replies
Jun 7, 2012
I am slightly confused on how a form should be closed. I have an exit button and have always done me.dispose in the click event. I just found out this causes the formclosing and formclosed not to be triggered. I found this out because I was updating the live database in the formclosing. Because of this I used me.close but this does not free up all the variables. Do I have to do me.close and then in the formclosed me.dispose in order to close a form correctly?
View 7 Replies
Jul 14, 2009
I have been requested to add a pop up form when the user chooses to quit the application.The form needs to stay visible until the application is finished with all its clean up code and then close down.
View 2 Replies