I managed to get it done, I pasted the code underneath incase someone else has a similar problem. John Dim form As System.Windows.Forms.Form For Each form In Me.MdiChildren form.Close() Next form
newbjohny
Posts
-
How to close all open MDI children without closing the Parent -
How to close all open MDI children without closing the ParentHi, I am creating a GUI to a database, I would like to know when I click a button to open a new database, all open MDI children relating to the old database that are open are closed without closing the parent form. I stored the name of the parent form into a module and tried this, but it only closes one, if there are more than one it does not work. ParentName.mdif.ActiveMdiChild.Close() Any suggestions are greatfully appreciated. John
-
Specified cast is not validHi, I have now fixed this problem, my MDACs were not up to date, so once I updated these everything worked fine. Thanks again. John.
-
Specified cast is not validHi Joe, I have declared tblName as a String at the top of the form as it is used a few times throughout the form. setTableName(tblName) is a method within a Module I created to store the name of the table in the database I am using so that I can use it in another form with the method getTableName. I've looked through and can't find any errors, like I said before it works fine at University. I emailed someone my project from another forum and they said it worked fine on their pc also so were unsure as the problem, theyve uploaded it to the forum if anyone wants to download it and look at the code first hand they can. It is message 12 by user "doWhileSomething" and the program is in the link Program, the forum is at :- http://www.vbcity.com/forums/topic.asp?tid=131204&page=2&#RID424741
-
Specified cast is not validIve just never heard them be called this before, in the dbConnection class there is :- Public tableNames() As String Public indexNames() As String Public triggerNames() As String Public viewNames() As String Public columnNames As New ArrayList() Public columnTypes As New ArrayList() Dim tables, i As Integer Dim sqlite_conn As SQLiteConnection Dim sqlite_cmd As SQLiteCommand Dim sqlite_datareader As SQLiteDataReader Dim sqlite_dataAdapter As SQLiteDataAdapter Dim dset As DataSet = New DataSet() Dim sqlite_commandBuilder As SQLiteCommandBuilder Private data_Table As New DataTable() Private rowPos As Integer = 0 in the viewdata form there is :- Dim dbConn As dbConnection = New dbConnection() Dim tableName As String Dim tblName As String
-
Specified cast is not validI think I should be just glad it works at University and leave it at that. Thanks again for your time and help, much appreciated. John
-
Specified cast is not validIt's very weird as you would suspect it to either work on both my home and Uni PC's or neither, not to work on one and not the other. Anyway thanks for your help and suggestions, they were very much appreciated. Thanks again John
-
Specified cast is not validHi Steve, the sqlite_*** are my names I've given to them. Like in the code above, I've simply added the _ so when I come to use it elsewhere I know what it is, so SQLiteCommandBuilder becomes sqilte_commandBuilder. It's just easier for me. They come from a 3rd party wrapper which is finisar.sqlite which can be found at http://adodotnetsqlite.sourceforge.net/ the expected line of "Dim sqlite_commandBuilder As SQLiteCommandBuilder" is present and has been declared at the top of the dbConnection class with all the other things that need declaring. Now that you mention it I don't know what those two lines are doing, they are there from when I started this project a long time ago and as it was working I never took anything out. I've took them out and they makeno difference to the error messge so it looks as if they were not needed at all. -- modified at 12:47 Saturday 5th August, 2006
-
Specified cast is not validThis is the selectAll code, I just called it selectAll(select *) as that is what I am doing from the database, selecting all from a table and displaying it to the user.
Public Function selectAll(ByVal strSQL As String, ByVal tableName As String) Dim dset As DataSet = New DataSet() sqlite_cmd.CommandText = (strSQL) sqlite_datareader = sqlite_cmd.ExecuteReader() Dim sqlite_dataAdapter As SQLiteDataAdapter = New SQLiteDataAdapter(strSQL, sqlite_conn) sqlite_commandBuilder = New SQLiteCommandBuilder(sqlite_dataAdapter) sqlite_dataAdapter.Fill(dset, tableName) Return dset End Function
-
Specified cast is not validNo, the function is in a dbConnection class and the cmbinsertdata is on a form. I'm sorry but I do not know what a member variable is. Is there someway I could zip my code and email it to you, it may be easier if you could see the code. John
-
Specified cast is not validThe previous two messages I wrote were from the Call stack. dbConnection is a class I created with all functions in that deal with the database. In the forms I want to connect to the database I put this line of code:- Dim dbConn As dbConnection = New dbConnection() selectAll is a function I created to select all from the given table name, put the contents into a dataSet and display in a DataGrid.
-
Specified cast is not validdbConnection is a class I created with all functions in that deal with the database. In the forms I want to connect to the database I put this line of code:- Dim dbConn As dbConnection = New dbConnection() selectAll is a function I created to select all from the given table name, put the contents into a dataSet and display in a DataGrid.
-
Specified cast is not validHi, sadly they did not teach us to do anything other that the try and catch, to be honest they never really taught us, all the lecture notes were ripped straight from the recommended text book. Anyway thats a aside issue. I've taken out the try-catch and it still crashes out with the same error, but two lines of code are highlighted, the one mentioned earlier in the form :- dset = dbConn.selectAll("SELECT * FROM " & tblName, tblName) and one in selectAll function in the connection class:- sqlite_dataAdapter.Fill(dset, tableName) A third line is highlighted in dissassembly but I have no idea what this is :- 00000014 mov ecx,eax
-
Specified cast is not validNo I am not notified of a missing reference, sorry, I did highlight the line but then when I put the code in code tags it must have got rid of the bold, the line that causes the error is this one :- dset = dbConn.selectAll("SELECT * FROM " & tblName, tblName) John
-
Specified cast is not validHi Steve, I have tried re-referencing all the references which are present, this does not fix the error. Is there anyway I could find out what DLL could be missing or should I just leave it and be thankful it works at University? John
-
Specified cast is not validHi Colin, I am not really sure what you mean, how do I get all the other good information? I have been taught this way at University so as not to crash out the program. What I find odd is that it can work on one machine and not the other.
-
Specified cast is not validHi, I am using VS.Net 2002 edition with the 1.1 framework both at University and at home (my home copy is from University using the University licence so I presume is exactly the same) I have created a front-end application for SQLite (an open source DBMS) which creates databases for users with no SQL knowledge. I link to the DBMS using a .dll file. When I fill a dataset with the contents of a table at University it works fine then goes onto fill a datagrid with this information. Yet when I run the same application at home I get a "Specified cast is not valid" error. Not one thing changes to the application, the data in the table, the .dll file, everything is the same in the two instances yet one works and the other doesn't. Does anyone know what is wrong, if I need to change a setting or install an update on my home PC or something? Any help is greatly appreciated. I have included my code and highlighted where the error shows up although I do not believe my code to be the problem as like I said it works on the University PC's. Many thanks John Code for populating dataset and datagrid
Private Sub cmbInsertData_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmbInsertData.SelectedIndexChanged Dim dset As DataSet '= New DataSet() If Len(cmbInsertData.SelectedItem) < 1 Then MessageBox.Show("Please choose a table to view") Else Try tblName = (cmbInsertData.Text) setTableName(tblName) dbConn.openExistingDatabse("Data Source=" & getDBName() & ";Version=3;New=False;Compress=True;") dbConn.createSQLCommand() Try dset = dbConn.selectAll("SELECT * FROM " & tblName, tblName) Catch es As Exception MessageBox.Show("error here -" & es.Message) End Try StoreDataSet.setDataSet(dset) DataGrid1.DataSource = dset.Tables(0).DefaultView Catch es As Exception MessageBox.Show(es.Message) End Try End If End Sub
Public Function selectAll(ByVal strSQL As String, ByVal tableName As String) Dim dset As DataSet = New DataSet() sqlite_cmd.CommandText = (strSQL) sqlite_datareader = sqlite_cmd.ExecuteReader() Dim sqlite_dataAdapter As SQLiteDataAdapter = New SQLiteDataAdapter(strSQL, sqlite_conn) sqlite_co
-
Problems updating a datasetHi, thanks foryour advice, I havesince managed to get the dataset working. Many thanks John
-
Problems updating a datasetHi, I am having trouble in updating my dataset, I create a dataset from a select command and display the details to a datagrid. I then goto the next new line in the datagrid and insert some new details then click the insertRow button (code below) and I get the following error message :- the exception which is caught states : - "Value cannot be null. Parameter name: dataset" I am not up to scratch with datasets, but all examples I can find of updates are where only one line of the dataset is shown at a time in text boxes and then a blank set of textboxes are displayed to add a new row then convert the textboxes.text to the add row command, but I am creating an application to be a front end to a database so none of the columns are known so I cannot create this form of input as the amount of textboxes would never be known. Please help Many thanks John Code for updating dataset [CODE] Private Sub btnInsertRow_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnInsertRow.Click Dim dset As DataSet tblName = (cmbInsertData.Text) dbConn.openExistingDatabse("Data Source=" & getDBName() & ";Version=3;New=False;Compress=True;") dbConn.createSQLCommand() Try dbConn.updateDataSet(dset, tblName) Catch es As Exception MessageBox.Show(es.Message) End Try End Sub[/CODE] [CODE] Public Sub updateDataSet(ByVal dset As DataSet, ByVal tableName As String) Dim sqlite_dataAdapter As SQLiteDataAdapter = New SQLiteDataAdapter() sqlite_commandBuilder = New SQLiteCommandBuilder(sqlite_dataAdapter) sqlite_dataAdapter.Update(dset, tableName) End Sub[/CODE]
-
Populating a comboBox with an ArrayListHi, thanks for this, works a treat, I can't blieve I forgot to use the array. Thanks again John.