|
This could be causes by a lot of things.
- an instanced form
- a still working Thread / Task / Backgroundworker
- a still hooked and working Eventhandler
- ...
Have you checked that each dynamicly (that means coded by you) created Object is Disposed, created Handle is rejected ?
|
|
|
|
|
I'm not sure if I'm missing something but on a quick test, if you have placed
Application.Exit() in your FormClosing event like this:
Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
Application.Exit()
End Sub
then you will get recursion with another FormClosing() event. In my test, the app did not
hang, however I did get a repeated call to FormClosing(). If you break at Application.Exit() and
then step you will probably get an immediate recursive call.
If you are testing whether to close you should use the args:
Private Sub Form1_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
if somecondition = False then
{
e.Cancel = True ' Do not close
}
End Sub
Perhaps if you showed us your code it would be clearer.
|
|
|
|
|
It seems that the cause of the problem is a splash form that is first open when the application is started.This is the startup form.
This is just a form that ask for a username and password.
After the user enter the username and password and click the ok button ,I call the
Mainform.show()
and the Main form is open .On the Main form's Shown event , I close the splashform , with
Splashform.close
splashform.dispose
I've made a test , and I start the Main form on application start ( without opening the splashform ).So the Main form is the startup form.
In this case the application closes correctly. ( even without calling Application.exit or Environment.exit )
What can I do ?
|
|
|
|
|
I don't know how complicated your implementation is.
As a test I've done this.
Created Form1 and Form2
On Form1 Load I did this:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim splash As New Form2
If splash.ShowDialog() = Windows.Forms.DialogResult.Cancel Then
Application.Exit()
End If
End Sub
In Form2 I just implemented a button:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
DialogResult = Windows.Forms.DialogResult.Cancel
End Sub
When the application runs and Form1 loads, Form2 is displayed from the load procedure.
Clicking the button causes Form2 to close gracefully with (DialogResult = Cancel) and return Cancel in this example and the application does not open.
Returning OK allows the app to open.
Also I tried this instead of Load() and it works also:
Private Sub Form1_Shown(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Shown
Dim dlg As New Form2
If dlg.ShowDialog() = Windows.Forms.DialogResult.Cancel Then
Application.Exit()
End If
End Sub
It should be this simple. If this does not help I can only suggest that you make sure you don't
do any initialization of data or processes prior to verifying user through the splash screen.
That is, don't initialize anything in Load() if you are showing the splash screen in Shown().
Hope this helps.
-- modified 21-Mar-18 17:50pm.
|
|
|
|
|
Wrap the splashform with a using-clause. You can do the same for the Mainform. Also, when running from the IDE, close all forms as you normally do, go to the IDE, hit "pauze", and see how many threads are running.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
hello everyone i just want to know how put/create a table in the report..
like Mycroft Holmes said..
"You don't "print a DGV in CR". You create your report in CR with the layout you want (use a table in the report) and set the data source to the same data as your DGV. You then print the report, NOT the DGV."
i don't really know what to do. i am new in using the crystal report. pls i need help thank you so much.
modified 18-Mar-18 13:10pm.
|
|
|
|
|
You could go back to Mycroft's message and ask him for any further advice.
|
|
|
|
|
Richard MacCutchan wrote: ask him for any further advice and get some google foo.
I ditched CR more than a decade ago after it took them 14 months to respond to a support request. The astonishing thing was that they DID respond!
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Did you consider panicking?
..or Googling for a tutorial on CR with VB.NET?
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
A "table" is "rows and columns".
CR does rows and columns.
I think you're being too literal.
You can even use a "picture" of a table. Or "hard-code" it.
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
im a begginer, anyone with idea on how to code in console using pattern printing
|
|
|
|
|
Yes, many people. But you need to provide much more detail about what pattern you are trying to print, and what problem you are getting in the code you have tried.
|
|
|
|
|
Hello !
I'm using entity framework 6 with Vb.net 2017 and sql server database.
I have this situation :
I have a bindingsource bound to an entity.
Mybindingsource.Datasource=( From t in context.mytable1 where t.nr>5 select t).Tolist
Some other user has updated the database , and one of the item on this bindingsource should be refreshed because is updated. ( On bindingsource I know the item that is updated on database ).
I want to know how to refresh that item , without executing again the query above that fill the entire bindingsource ?
Thank you !
|
|
|
|
|
You execute the query again. You have no choice.
|
|
|
|
|
If you are not going to use "equals", then you use FirstOrDefault(); else SingleOrDefault(); not "ToList".
("xxxOrDefault" because you will "crash" if your entity set is empty);
Then check the SQL generated to confirm your intentions (db call logging option).
"(I) am amazed to see myself here rather than there ... now rather than then".
― Blaise Pascal
|
|
|
|
|
Hi, I'm new here and just recently found this great messageboard. I'm working on a peice of code that requires a program to link to a database with multiple tables in it. I'm trying to link the program to the database and then use a combo box (or some other GUI object) "point" to the different tables in the database but I can't seem to figure it out. Here is the following code I'm using...
Private Sub cmbloadMasterSchedule_click()
dlgcommonDialog.Filter = "Microsoft Access Database Applications(*mdb)"
dlgCommonDialog.ShowOpen
AdoTeamStatsInputUtility.ConnectionString = dlgCommonDialog.InitDir
End Sub
Private Sub ClickEvent()
AdoTeamStatsInputUtility.RecordSource = AdoTeamStatsInputUtility.ConnectionString
cmbListTablesInRecordSet.ItemData (adoTeamStatsInputUtility.RecordSource)
End Sub
I just can't seem to make the combo box display the tables of the Database or allow it to point to a particular Table within the Database. Does anyone have any advice on this?
|
|
|
|
|
Where is the code that builds the combo box?
|
|
|
|
|
Private Sub ClickEvent()
AdoTeamStatsInputUtility.RecordSource = AdoTeamStatsInputUtility.ConnectionString
cmbListTablesInRecordSet.ItemData (adoTeamStatsInputUtility.RecordSource)
End Sub
That is the code that builds the combo box. I know, its not much. That is where the problem is. I'm actually just guessing on how to do it. What I was hoping for is too have the database link with the connection string from the above code, I could use the combo box (with listed tables within the Combo Box) to "Point" to the particular Table I want to input the data.
|
|
|
|
|
|
I'll bet a banana that there is in VB6.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Yes, I'm using Visual Basic 6. Ill look up the "ItemData" object in the MSDN Library. I have some revised code that might be a little clear on this topic. I found out I was using the wrong database object to access the Database. How about this code...
Private Sub cmdLoadMasterSchedule_Click()
dlgCommonDialog.Filter = "Microsoft Access Database Applications(*.mdb)"
dlgCommonDialog.ShowOpen
Data1.Connect = dlgCommonDialog.InitDir
End Sub
Private Sub cmbListTablesInRecordSet_Click()
cmbListTablesInRecordSet.DataSource (Data1.RecordSource)
cmbListTablesInRecordSet.DataField ""
End Sub
I think this new code links to the database, but I'm still stumped on the second code part. I can access the data by clicking on the RecordSource property and choose a particular table to point too, but I still am not sure how to do it with the above code. .DataFeild and .DataSource properties still perplex me.
Any advice here with this new code?
|
|
|
|
|
D. Doulas wrote:
Any advice here with this new code? No, I don't support even the idea of writing anything new in VB6. It is a dead language and there's no good reason to use it.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
With all due respect... but do you mind? This is probably the only message board left I can find tech support for VB.
|
|
|
|
|
D. Doulas wrote: This is probably the only message board left I can find tech support for VB. I don't mind you getting help from others; I do mind the idea of actively writing VB6-code.
..and it's not tech support; its a bunch of volunteers that you are depending on to keep it alive.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|
|
Also, a connection-string is not just a filepath.
Login Tutorial Using Access Database - Visual Basic .NET[^]; shows how to connect and read from the datbase.
D. Doulas wrote: Does anyone have any advice on this? Start with any tutorial that shows how to execute a query. Find a query that returns all table-names. Combine both ideas.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
"If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
|
|
|
|