Out of memory exception

JohnM

Well-known member
Joined
Jul 2, 2004
Messages
116
Location
Massachusetts
Programming Experience
1-3
The first form in my application is a sign in. The signing in is: (entering a student ID and entering student initials. 2 separate textboxes). It has a continue button and a close button. The continue button opens the next form (each form has an exit button which saves information from the form and then goes back to the sign-in form). The close button exits the application. I was testing the application by entering serveral different student ID's and initials and continuing to the next form then exiting that form (saving the information each time) and going back to the sign-in form and enetering another different student id and initials. Just kept entereing new student id's and initials without closing the application. Then I got an out of memory exception. How can I be sure that all the remnants of the previous student's forms are cleared from memory. Is that the reason why the out of memory error occurred? You can tell I am not very good yet at this.
Thank you for your help.
John M
 
This is weird. Unless you are using the Me.Hide() to close the form and not Me.Dispose(). Hiding the form and creating the new form will cause the form to be remain in the memory.

The other posible reason is maybe you have a for/while loop in your application that will create a large amount of object and it was not release after use. I think you are not in this case.
 
My code

VB.NET:
[FONT=Courier New][COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] frmWarning_Load([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] System.Object, [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.EventArgs) [COLOR=blue]Handles[/COLOR] [COLOR=blue]MyBase[/COLOR].Load[/FONT]
[FONT=Courier New]lblWarning.Text = "The following program is not a game" & _[/FONT]
[FONT=Courier New]"Click to begin Click to close."[/FONT]
 
[FONT=Courier New]OleDbDataAdapter1.Fill(StudentPicks1)[/FONT]
[FONT=Courier New]btnHere.Focus()[/FONT]
[FONT=Courier New]btnContinue.Enabled = [COLOR=blue]False[/COLOR][/FONT]
[FONT=Courier New]btnContinue.Hide()[/FONT]
[FONT=Courier New]tbxInitials.Clear()[/FONT]
[FONT=Courier New]tbxStuID.Clear()[/FONT]
[FONT=Courier New]tbxInitials.Hide()[/FONT]
[FONT=Courier New]tbxStuID.Hide()[/FONT]
[FONT=Courier New]grpBoxSignOn.Hide()[/FONT]
[FONT=Courier New]lblID.Hide()[/FONT]
[FONT=Courier New]lblInitials.Hide()[/FONT]
[FONT=Courier New]lblSignIn.Hide()[/FONT]
[FONT=Courier New]dgdCheckUser.Hide()[/FONT]
[FONT=Courier New][COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] btnClose_Click([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] System.Object, [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.EventArgs) [COLOR=blue]Handles[/COLOR] btnClose.Click[/FONT]
[FONT=Courier New][COLOR=blue]Me[/COLOR].Close()[/FONT]
[FONT=Courier New][COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] btnHere_Click([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] System.Object, [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.EventArgs) [COLOR=blue]Handles[/COLOR] btnHere.Click[/FONT]
[FONT=Courier New]OleDbDataAdapter1.Fill(StudentPicks1) grpBoxSignOn.Show()[/FONT]
[FONT=Courier New]tbxInitials.Show()[/FONT]
[FONT=Courier New]tbxStuID.Show()[/FONT]
[FONT=Courier New]tbxInitials.Clear()[/FONT]
[FONT=Courier New]tbxStuID.Clear()[/FONT]
[FONT=Courier New]IntLenID = 0[/FONT]
[FONT=Courier New]IntLenINI = 0[/FONT]
[FONT=Courier New]lblID.Show()[/FONT]
[FONT=Courier New]lblInitials.Show()[/FONT]
[FONT=Courier New]lblSignIn.Text = " Enter your 3-letter initials and a 3-digit number." & _[/FONT]
[FONT=Courier New]" You will need them to save your costs should you not finish in one sitting." & _[/FONT]
[FONT=Courier New]" Enter only letters for initials and numbers for an ID."[/FONT]
[FONT=Courier New]lblSignIn.Show()[/FONT]
[FONT=Courier New]btnContinue.Enabled = [COLOR=blue]False[/COLOR][/FONT]
[FONT=Courier New]btnContinue.Show()[/FONT]
[FONT=Courier New]tbxInitials.Focus()[/FONT]
 
[FONT=Courier New][COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]Private[/COLOR] [COLOR=blue]Sub[/COLOR] btnContinue_Click([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] System.Object, [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.EventArgs) [COLOR=blue]Handles[/COLOR] btnContinue.Click[/FONT]
[FONT=Courier New][COLOR=blue]If[/COLOR] UserINI = " " [COLOR=blue]Or[/COLOR] UserINI = "" [COLOR=blue]Or[/COLOR] IntLenINI <> 3 [COLOR=blue]Then[/COLOR][/FONT]
[FONT=Courier New]MessageBox.Show("The Initials are not correct. You must enter 3 letters.", "User initials not correct.")[/FONT]
[FONT=Courier New]tbxInitials.Clear()[/FONT]
[FONT=Courier New]tbxInitials.Focus()[/FONT]
[FONT=Courier New][COLOR=blue]Exit[/COLOR] [COLOR=blue]Sub[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]If[/COLOR] StuID <= 0 [COLOR=blue]Or[/COLOR] IntLenID <> 3 [COLOR=blue]Or[/COLOR] tbxStuID.Text = " " [COLOR=blue]Then[/COLOR][/FONT]
[FONT=Courier New]MessageBox.Show("Student ID isn't correct. You must enter 3 digits.", "User ID isn't correct.")[/FONT]
[FONT=Courier New]tbxStuID.Clear()[/FONT]
[FONT=Courier New]tbxStuID.Focus()[/FONT]
[FONT=Courier New][COLOR=blue]Exit[/COLOR] [COLOR=blue]Sub[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR][/FONT]
[FONT=Courier New]grpBoxSignOn.Hide()[/FONT]
[FONT=Courier New]tbxInitials.Hide()[/FONT]
[FONT=Courier New]tbxStuID.Hide()[/FONT]
[FONT=Courier New]lblID.Hide()[/FONT]
[FONT=Courier New]lblInitials.Hide()[/FONT]
[FONT=Courier New]lblSignIn.Hide()[/FONT]
[FONT=Courier New]btnContinue.Hide()[/FONT]
 
[FONT=Courier New][COLOR=blue]Dim[/COLOR] SP1 [COLOR=blue]As[/COLOR] DataRow[/FONT]
[FONT=Courier New][COLOR=blue]Dim[/COLOR] SIN [COLOR=blue]As[/COLOR] [COLOR=blue]String[/COLOR] [COLOR=green]' Students Initials[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]Dim[/COLOR] SID [COLOR=blue]As[/COLOR] [COLOR=blue]Integer[/COLOR] [COLOR=green]' Students ID[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]Dim[/COLOR] SPobjDataTable [COLOR=blue]As[/COLOR] [COLOR=blue]New[/COLOR] DataTable("StudentPicks")[/FONT]
[FONT=Courier New][COLOR=green]' The for/next loop will read all the rows in the entire datagrid[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]For[/COLOR] [COLOR=blue]Each[/COLOR] SP1 [COLOR=blue]In[/COLOR] StudentPicks1.Tables("StudentPicks").Rows[/FONT]
 
[FONT=Courier New]SIN = [COLOR=blue]CStr[/COLOR](SP1.Item(0)) [COLOR=green]' Students Initials[/COLOR][/FONT]
[FONT=Courier New]SID = [COLOR=blue]CInt[/COLOR](SP1.Item(1)) [COLOR=green]' Students ID[/COLOR][/FONT]
[FONT=Courier New]Fini = [COLOR=blue]CInt[/COLOR](SP1.Item(8)) [COLOR=green]' number of last completed page[/COLOR][/FONT]
 
[FONT=Courier New][COLOR=blue]Dim[/COLOR] StuResult [COLOR=blue]As[/COLOR] DialogResult[/FONT]
 
[FONT=Courier New][COLOR=green]'If UserINI = SIN And StuID = SID checks to see if form last completed[/COLOR][/FONT]
[FONT=Courier New][COLOR=green]'in not the last one (13) if so then delete it[/COLOR][/FONT]
 
[FONT=Courier New][COLOR=blue]If[/COLOR] [COLOR=blue]String[/COLOR].Compare(UserINI, SIN, [COLOR=blue]True[/COLOR]) = 0 [COLOR=blue]And[/COLOR] [COLOR=blue]String[/COLOR].Compare([COLOR=blue]CStr[/COLOR](StuID), [COLOR=blue]CStr[/COLOR](SID), [COLOR=blue]True[/COLOR]) = 0 [COLOR=blue]And[/COLOR] Fini <> 6 [COLOR=blue]Then[/COLOR][/FONT]
 
[FONT=Courier New]StuResult = MessageBox.Show("You have an incomplete project. " & _[/FONT]
[FONT=Courier New]"Click YES to start where you left off. NO to start a new one.", " New or Old Project", MessageBoxButtons.YesNoCancel)[/FONT]
 
[FONT=Courier New][COLOR=blue]If[/COLOR] StuResult = DialogResult.Cancel [COLOR=blue]Then[/COLOR][/FONT]
[FONT=Courier New]btnContinue.Enabled = [COLOR=blue]False[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]Exit[/COLOR] [COLOR=blue]Sub[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR][/FONT]
 
[FONT=Courier New][COLOR=blue]If[/COLOR] StuResult = DialogResult.Yes [COLOR=blue]Then[/COLOR][/FONT]
[FONT=Courier New]MessageBox.Show("The program will begin at first category after your last completed one.", "Finish your Project.")[/FONT]
 
[FONT=Courier New][COLOR=green]' If yes to continue where user left off then fill in cost variables with data from user's table[/COLOR][/FONT]
 
[FONT=Courier New]f1 = [COLOR=blue]CInt[/COLOR](SP1.Item(2)) [COLOR=green]‘Cat1[/COLOR][/FONT]
[FONT=Courier New]l11 = [COLOR=blue]CSng[/COLOR](SP1.Item(3)) [COLOR=green]‘cat2[/COLOR][/FONT]
[FONT=Courier New]d8 = [COLOR=blue]CSng[/COLOR](SP1.Item(4)) [COLOR=green]'Cat3[/COLOR][/FONT]
[FONT=Courier New]l1 = [COLOR=blue]CSng[/COLOR](SP1.Item(5)) [COLOR=green]'Cat4[/COLOR][/FONT]
[FONT=Courier New]k3 = [COLOR=blue]CSng[/COLOR](SP1.Item(6)) [COLOR=green]'Cat5[/COLOR][/FONT]
[FONT=Courier New]k92 = [COLOR=blue]CInt[/COLOR](SP1.Item(7)) [COLOR=green]'Cat6[/COLOR][/FONT]
[FONT=Courier New]Fini = [COLOR=blue]CInt[/COLOR](SP1.Item(8)) [COLOR=green]' Flag for last completed [/COLOR][/FONT]
 
[FONT=Courier New][COLOR=blue]Dim[/COLOR] run [COLOR=blue]As[/COLOR] [COLOR=blue]Integer[/COLOR][/FONT]
[FONT=Courier New][COLOR=green]'This [/COLOR][/FONT][COLOR=green][FONT=Courier New]LOOP[/FONT][/COLOR][COLOR=green][FONT=Courier New] forces all the Form flags that were done to 1[/FONT][/COLOR]
[FONT=Courier New]D00.Clear(D00, 0, 6)[/FONT]
 
[FONT=Courier New][COLOR=blue]Do[/COLOR] [COLOR=blue]While[/COLOR] run <= Fini[/FONT]
[FONT=Courier New]D00(run) = 1[/FONT]
[FONT=Courier New]run = run + 1[/FONT]
[COLOR=blue][FONT=Courier New]Loop[/FONT][/COLOR]
[FONT=Courier New]run = Fini + 1[/FONT]
[FONT=Courier New][COLOR=blue]Select[/COLOR] [COLOR=blue]Case[/COLOR] run [/FONT]
 
[FONT=Courier New][COLOR=blue]Case[/COLOR] 0[/FONT]
[FONT=Courier New][COLOR=blue]Dim[/COLOR] form2 [COLOR=blue]As[/COLOR] [COLOR=blue]New[/COLOR] frmStart[/FONT]
[FONT=Courier New]form2.Opacity = 0[/FONT]
[FONT=Courier New]Application.DoEvents()[/FONT]
[FONT=Courier New][COLOR=blue]Do[/COLOR] [COLOR=blue]While[/COLOR] form2.Opacity < 1.0[/FONT]
[FONT=Courier New]form2.Opacity += 0.025[/FONT]
[FONT=Courier New]Threading.Thread.Sleep(25)[/FONT]
[FONT=Courier New]form2.Show()[/FONT]
[COLOR=blue][FONT=Courier New]Loop[/FONT][/COLOR]
 
[FONT=Courier New][COLOR=blue]Case[/COLOR] 1[/FONT]
[FONT=Courier New][COLOR=blue]Dim[/COLOR] form16 [COLOR=blue]As[/COLOR] [COLOR=blue]New[/COLOR] frmCat1[/FONT]
[FONT=Courier New]form16.Opacity = 0[/FONT]
[FONT=Courier New]Application.DoEvents()[/FONT]
[FONT=Courier New][COLOR=blue]Do[/COLOR] [COLOR=blue]While[/COLOR] form16.Opacity < 1.0[/FONT]
[FONT=Courier New]form16.Opacity += 0.025[/FONT]
[FONT=Courier New]Threading.Thread.Sleep(25)[/FONT]
[FONT=Courier New]form16.Show()[/FONT]
[COLOR=blue][FONT=Courier New]Loop[/FONT][/COLOR]
 
[FONT=Courier New][COLOR=blue]Case[/COLOR] 2[/FONT]
[FONT=Courier New][COLOR=blue]Dim[/COLOR] form4 [COLOR=blue]As[/COLOR] [COLOR=blue]New[/COLOR] frmCat2[/FONT]
[FONT=Courier New]form4.Opacity = 0[/FONT]
[FONT=Courier New]Application.DoEvents()[/FONT]
[FONT=Courier New][COLOR=blue]Do[/COLOR] [COLOR=blue]While[/COLOR] form4.Opacity < 1.0[/FONT]
[FONT=Courier New]form4.Opacity += 0.025[/FONT]
[FONT=Courier New]Threading.Thread.Sleep(25)[/FONT]
[FONT=Courier New]form4.Show()[/FONT]
[COLOR=blue][FONT=Courier New]Loop[/FONT][/COLOR]
 
[FONT=Courier New][COLOR=blue]Case[/COLOR] 3[/FONT]
[FONT=Courier New][COLOR=blue]Dim[/COLOR] form17 [COLOR=blue]As[/COLOR] [COLOR=blue]New[/COLOR] frmCat3[/FONT]
[FONT=Courier New]form17.Opacity = 0[/FONT]
[FONT=Courier New]Application.DoEvents()[/FONT]
[FONT=Courier New][COLOR=blue]Do[/COLOR] [COLOR=blue]While[/COLOR] form17.Opacity < 1.0[/FONT]
[FONT=Courier New]form17.Opacity += 0.025[/FONT]
[FONT=Courier New]Threading.Thread.Sleep(25)[/FONT]
[FONT=Courier New]form17.Show()[/FONT]
[COLOR=blue][FONT=Courier New]Loop[/FONT][/COLOR]
[FONT=Courier New][COLOR=blue]Case[/COLOR] 4[/FONT]
[FONT=Courier New][COLOR=blue]Dim[/COLOR] form12 [COLOR=blue]As[/COLOR] [COLOR=blue]New[/COLOR] frmCat4[/FONT]
[FONT=Courier New]form12.Opacity = 0[/FONT]
[FONT=Courier New]Application.DoEvents()[/FONT]
[FONT=Courier New][COLOR=blue]Do[/COLOR] [COLOR=blue]While[/COLOR] form12.Opacity < 1.0[/FONT]
[FONT=Courier New]form12.Opacity += 0.025[/FONT]
[FONT=Courier New]Threading.Thread.Sleep(25)[/FONT]
[FONT=Courier New]form12.Show()[/FONT]
[COLOR=blue][FONT=Courier New]Loop[/FONT][/COLOR]
 
[FONT=Courier New][COLOR=blue]Case[/COLOR] 5[/FONT]
[FONT=Courier New][COLOR=blue]Dim[/COLOR] form6 [COLOR=blue]As[/COLOR] [COLOR=blue]New[/COLOR] frmcat5[/FONT]
[FONT=Courier New]form6.Opacity = 0[/FONT]
[FONT=Courier New]Application.DoEvents()[/FONT]
[FONT=Courier New][COLOR=blue]Do[/COLOR] [COLOR=blue]While[/COLOR] form6.Opacity < 1.0[/FONT]
[FONT=Courier New]form6.Opacity += 0.025[/FONT]
[FONT=Courier New]Threading.Thread.Sleep(25)[/FONT]
[FONT=Courier New]form6.Show()[/FONT]
[COLOR=blue][FONT=Courier New]Loop[/FONT][/COLOR]
 
[FONT=Courier New][COLOR=blue]Case[/COLOR] 6[/FONT]
[FONT=Courier New][COLOR=blue]Dim[/COLOR] form5 [COLOR=blue]As[/COLOR] [COLOR=blue]New[/COLOR] frmcat6[/FONT]
[FONT=Courier New]form5.Opacity = 0[/FONT]
[FONT=Courier New]Application.DoEvents()[/FONT]
[FONT=Courier New][COLOR=blue]Do[/COLOR] [COLOR=blue]While[/COLOR] form5.Opacity < 1.0[/FONT]
[FONT=Courier New]form5.Opacity += 0.025[/FONT]
[FONT=Courier New]Threading.Thread.Sleep(25)[/FONT]
[FONT=Courier New]form5.Show()[/FONT]
[COLOR=blue][FONT=Courier New]Loop[/FONT][/COLOR]
[FONT=Courier New][COLOR=blue]End[/COLOR] [COLOR=blue]Select[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]Exit[/COLOR] [COLOR=blue]Sub[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]Else[/COLOR][/FONT]
 
[FONT=Courier New]MessageBox.Show("Your previous project will be deleted and a new one started.", "Start New Program.")[/FONT]
[FONT=Courier New][COLOR=green]' will delete the User's record of their previous work[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]Dim[/COLOR] ConnString [COLOR=blue]As[/COLOR] [COLOR=blue]String[/COLOR] = "Provider=Microsoft.Jet.OLEDB.4.0;" & _[/FONT]
[FONT=Courier New]"Data Source=C:\NMPNMB\StudentValues.mdb;" & _[/FONT]
[FONT=Courier New]"User ID=Admin;" & _[/FONT]
[FONT=Courier New]"Password="[/FONT]
[FONT=Courier New][COLOR=blue]Dim[/COLOR] cnn1 [COLOR=blue]As[/COLOR] OleDbConnection = [COLOR=blue]New[/COLOR] OleDbConnection(ConnString)[/FONT]
[FONT=Courier New][COLOR=blue]Dim[/COLOR] command [COLOR=blue]As[/COLOR] [COLOR=blue]String[/COLOR] = "DELETE FROM StudentPicks WHERE (StudentInitials='" & UserINI & "') AND (StudentID=" & StuID & ");"[/FONT]
[FONT=Courier New]cnn1.Open()[/FONT]
[FONT=Courier New][COLOR=blue]Dim[/COLOR] Objcommand [COLOR=blue]As[/COLOR] [COLOR=blue]New[/COLOR] OleDbCommand(command, cnn1)[/FONT]
[FONT=Courier New]MsgBox("Deleting NOT successful. Contact your System Administrator.")[/FONT]
[FONT=Courier New]MsgBox(" Reader " & exc.ToString)[/FONT]
[FONT=Courier New]MsgBox(" ----> " & command)[/FONT]
[FONT=Courier New]MessageBox.Show("Your previous selections were deleted.", "Deletion Successful!")[/FONT]
[FONT=Courier New]cnn1.Close()[/FONT]
[FONT=Courier New]tbxInitials.Text = " "[/FONT]
[FONT=Courier New]tbxStuID.Text = " "[/FONT]
[FONT=Courier New]D00.Clear(D00, 0, 6) [COLOR=green]' clear the forms completion values[/COLOR][/FONT]
[FONT=Courier New]Fini = 0 [COLOR=green]' added [/COLOR][/FONT][COLOR=green][FONT=Courier New]11/24/06[/FONT][/COLOR][COLOR=green][FONT=Courier New] clear out variable that tracks last form completed[/FONT][/COLOR]
[FONT=Courier New][COLOR=blue]Exit[/COLOR] [COLOR=blue]For[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]Else[/COLOR][/FONT]
[FONT=Courier New]If [COLOR=blue]String[/COLOR].Compare(UserINI, SIN, [COLOR=blue]True[/COLOR]) = 0 [COLOR=blue]And[/COLOR] [COLOR=blue]String[/COLOR].Compare([COLOR=blue]CStr[/COLOR](StuID), [COLOR=blue]CStr[/COLOR](SID), [COLOR=blue]True[/COLOR]) = 0 [COLOR=blue]And[/COLOR] Fini = 6 [COLOR=blue]Then[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]Dim[/COLOR] StuResult2 [COLOR=blue]As[/COLOR] DialogResult[/FONT]
[FONT=Courier New]StuResult2 = MessageBox.Show("Want to review or delete it (start fresh)? " & _[/FONT]
[FONT=Courier New]"YES to review. NO to delete (start anew).", "You have a completed Project.", MessageBoxButtons.YesNoCancel)[/FONT]
 
[FONT=Courier New][COLOR=blue]If[/COLOR] StuResult2 = DialogResult.Cancel [COLOR=blue]Then[/COLOR][/FONT]
[FONT=Courier New]btnContinue.Enabled = [COLOR=blue]False[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]Exit[/COLOR] [COLOR=blue]Sub[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR][/FONT]
 
[FONT=Courier New][COLOR=blue]If[/COLOR] StuResult2 = DialogResult.Yes [COLOR=blue]Then[/COLOR][/FONT]
[FONT=Courier New]f1 = [COLOR=blue]CInt[/COLOR](SP1.Item(2)) [COLOR=green]'Apt[/COLOR][/FONT]
[FONT=Courier New]l11 = [COLOR=blue]CSng[/COLOR](SP1.Item(3)) [COLOR=green]'Bus[/COLOR][/FONT]
[FONT=Courier New]d8 = [COLOR=blue]CSng[/COLOR](SP1.Item(4)) [COLOR=green]'Cable[/COLOR][/FONT]
[FONT=Courier New]l1 = [COLOR=blue]CSng[/COLOR](SP1.Item(5)) [COLOR=green]'Car[/COLOR][/FONT]
[FONT=Courier New]k3 = [COLOR=blue]CSng[/COLOR](SP1.Item(6)) [COLOR=green]'CarLeased[/COLOR][/FONT]
[FONT=Courier New]k92 = [COLOR=blue]CInt[/COLOR](SP1.Item(7)) [COLOR=green]'Car repair[/COLOR][/FONT]
[FONT=Courier New]Fini = [COLOR=blue]CInt[/COLOR](SP1.Item(8)) [COLOR=green]' Flag for last completed form [/COLOR][/FONT]
[FONT=Courier New]D00.Clear(D00, 0, 6)[/FONT]
 
[FONT=Courier New][COLOR=green]' needed to darken all completed buttons[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]Dim[/COLOR] run [COLOR=blue]As[/COLOR] [COLOR=blue]Integer[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]Do[/COLOR] [COLOR=blue]While[/COLOR] run <= Fini[/FONT]
[FONT=Courier New]D00(run) = 1[/FONT]
[FONT=Courier New]run = run + 1[/FONT]
[COLOR=blue][FONT=Courier New]Loop[/FONT][/COLOR]
 
[FONT=Courier New][COLOR=blue]Dim[/COLOR] form11 [COLOR=blue]As[/COLOR] [COLOR=blue]New[/COLOR] frmCatALL[/FONT]
[FONT=Courier New]form11.Opacity = 0[/FONT]
[FONT=Courier New]Application.DoEvents()[/FONT]
[FONT=Courier New][COLOR=blue]Do[/COLOR] [COLOR=blue]While[/COLOR] form11.Opacity < 1.0[/FONT]
[FONT=Courier New]form11.Opacity += 0.025[/FONT]
[FONT=Courier New]Threading.Thread.Sleep(25)[/FONT]
[FONT=Courier New]form11.Show()[/FONT]
[COLOR=blue][FONT=Courier New]Loop[/FONT][/COLOR]
[FONT=Courier New][COLOR=blue]Exit[/COLOR] [COLOR=blue]Sub[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]Else[/COLOR][/FONT]
[COLOR=blue][FONT=Courier New]Dim[/FONT][/COLOR][FONT=Courier New] ConnString [COLOR=blue]As[/COLOR] [COLOR=blue]String[/COLOR] = "Provider=Microsoft.Jet.OLEDB.4.0;" & _[/FONT]
[FONT=Courier New]"Data Source=C:\NMPNMB\StudentValues.mdb;" & _[/FONT]
[FONT=Courier New]"User ID=Admin;" & _[/FONT]
[FONT=Courier New]"Password="[/FONT]
 
[COLOR=blue][FONT=Courier New]Dim[/FONT][/COLOR][FONT=Courier New] cnn1 [COLOR=blue]As[/COLOR] OleDbConnection = [COLOR=blue]New[/COLOR] OleDbConnection(ConnString)[/FONT]
[COLOR=blue][FONT=Courier New]Dim[/FONT][/COLOR][FONT=Courier New] command [COLOR=blue]As[/COLOR] [COLOR=blue]String[/COLOR] = "DELETE FROM StudentPicks WHERE (StudentInitials='" & UserINI & "') AND (StudentID=" & StuID & ");"[/FONT]
[FONT=Courier New]Cnn1.Open()[/FONT]
[COLOR=blue][FONT=Courier New]Dim[/FONT][/COLOR][FONT=Courier New] Objcommand [COLOR=blue]As[/COLOR] [COLOR=blue]New[/COLOR] OleDbCommand(command, cnn1)[/FONT]
 
 
[FONT=Courier New]MsgBox("Deleting NOT successful. Contact your System Administrator.")[/FONT]
[FONT=Courier New]MsgBox(" Reader " & exc.ToString)[/FONT]
[FONT=Courier New]MsgBox(" ----> " & command)[/FONT]
[FONT=Courier New]MessageBox.Show("Your previous selections were deleted.", "Deletion Successful!")[/FONT]
[FONT=Courier New]cnn1.Close()[/FONT]
[FONT=Courier New]tbxInitials.Text = " "[/FONT]
[FONT=Courier New]tbxStuID.Text = " "[/FONT]
[FONT=Courier New]D00.Clear(D00, 0, 6) [/FONT]
[FONT=Courier New]Fini = 0 [/FONT]
[FONT=Courier New]Fini = [COLOR=blue]CInt[/COLOR](SP1.Item(8)) [/FONT]
[FONT=Courier New][COLOR=blue]Exit[/COLOR] [COLOR=blue]For[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]Else[/COLOR] : [COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]Next[/COLOR][/FONT]
[FONT=Courier New]D00.Clear(D00, 0, 6) [COLOR=green]' clear for a new project[/COLOR][/FONT]
[FONT=Courier New]Fini = 0 [/FONT]
[FONT=Courier New][COLOR=blue]Dim[/COLOR] form15 [COLOR=blue]As[/COLOR] [COLOR=blue]New[/COLOR] frmOpening[/FONT]
[FONT=Courier New]form15.Opacity = 0[/FONT]
[FONT=Courier New]Application.DoEvents()[/FONT]
[FONT=Courier New][COLOR=blue]Do[/COLOR] [COLOR=blue]While[/COLOR] form15.Opacity < 1.0[/FONT]
[FONT=Courier New]form15.Opacity += 0.025[/FONT]
[FONT=Courier New]Threading.Thread.Sleep(25)[/FONT]
[FONT=Courier New]form15.Show()[/FONT]
[COLOR=blue][FONT=Courier New]Loop[/FONT][/COLOR]
[FONT=Courier New][COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR][/FONT]
 
[COLOR=blue][FONT=Courier New]Private[/FONT][/COLOR][FONT=Courier New] [COLOR=blue]Sub[/COLOR] tbxStuID_KeyPress([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] [COLOR=blue]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.Windows.Forms.KeyPressEventArgs) [COLOR=blue]Handles[/COLOR] tbxStuID.KeyPress[/FONT]
[FONT=Courier New]IntLenID = tbxStuID.TextLength[/FONT]
[FONT=Courier New][COLOR=blue]If[/COLOR] AscW(e.KeyChar) = Keys.Return [COLOR=blue]And[/COLOR] IntLenID = 3 [COLOR=blue]Or[/COLOR] AscW(e.KeyChar) = Keys.Tab [COLOR=blue]And[/COLOR] IntLenID = 3 [COLOR=blue]Then[/COLOR] [COLOR=green]' was AND IntLenId 11/14/06[/COLOR][/FONT]
[FONT=Courier New]StuID = [COLOR=blue]CInt[/COLOR](tbxStuID.Text)[/FONT]
[FONT=Courier New]btnContinue.Enabled = [COLOR=blue]True[/COLOR][/FONT]
[FONT=Courier New]btnContinue.Focus()[/FONT]
[FONT=Courier New][COLOR=green]' btnContinue.PerformClick()[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]Exit[/COLOR] [COLOR=blue]Sub[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]ElseIf[/COLOR] [COLOR=blue]Char[/COLOR].IsDigit(e.KeyChar) = [COLOR=blue]False[/COLOR] [COLOR=blue]Then[/COLOR][/FONT]
[FONT=Courier New]tbxStuID.Clear()[/FONT]
[FONT=Courier New]IntLenID = 0[/FONT]
[FONT=Courier New]e.Handled = [COLOR=blue]True[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR][/FONT]
[COLOR=blue][FONT=Courier New]Private[/FONT][/COLOR][FONT=Courier New] [COLOR=blue]Sub[/COLOR] tbxInitials_KeyPress([COLOR=blue]ByVal[/COLOR] sender [COLOR=blue]As[/COLOR] [COLOR=blue]Object[/COLOR], [COLOR=blue]ByVal[/COLOR] e [COLOR=blue]As[/COLOR] System.Windows.Forms.KeyPressEventArgs) [COLOR=blue]Handles[/COLOR] tbxInitials.KeyPress[/FONT]
 
[COLOR=blue][FONT=Courier New]If[/FONT][/COLOR][FONT=Courier New] AscW(e.KeyChar) = Keys.ControlKey [COLOR=blue]Then[/COLOR][/FONT]
[FONT=Courier New]MessageBox.Show("Control Keys not allowed. Must enter 3 letters.", "Control Keys.")[/FONT]
[FONT=Courier New]tbxInitials.Focus()[/FONT]
[FONT=Courier New][COLOR=blue]Exit[/COLOR] [COLOR=blue]Sub[/COLOR][/FONT]
[COLOR=blue][FONT=Courier New]End[/FONT][/COLOR][FONT=Courier New] [COLOR=blue]If[/COLOR][/FONT]
[FONT=Courier New]IntLenINI = tbxInitials.TextLength[/FONT]
Internet Explorer 7 keeps crashing on me. So I am trying again to post this.

Here's the code of the form that is used to sign in and somewhere here causes an Out of Memory error. It only happened when I kept entering different sign ins and going to the next form and coming back to sign in with a different person never leaving the application.

I appreciate your interest and your patience in trying to understand what I am doing here. I am working on becoming more efficent in my coding.

John M


VB.NET:
[COLOR=blue][FONT=Courier New]If[/FONT][/COLOR][FONT=Courier New] AscW(e.KeyChar) = Keys.Return [COLOR=blue]And[/COLOR] IntLenINI = 3 [COLOR=blue]Or[/COLOR] AscW(e.KeyChar) = Keys.Tab [COLOR=blue]And[/COLOR] IntLenINI = 3 [COLOR=blue]Then[/COLOR][/FONT]
[FONT=Courier New]tbxStuID.Focus()[/FONT]
[FONT=Courier New]UserINI = tbxInitials.Text[/FONT]
[FONT=Courier New][COLOR=green]'tbxInitials.Enabled = False[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]Exit[/COLOR] [COLOR=blue]Sub[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]ElseIf[/COLOR] [COLOR=blue]Not[/COLOR] [COLOR=blue]Char[/COLOR].IsLetter(e.KeyChar) = [COLOR=blue]True[/COLOR] [COLOR=blue]Then[/COLOR][/FONT]
[FONT=Courier New]tbxInitials.Clear()[/FONT]
[FONT=Courier New]tbxInitials.Focus()[/FONT]
[FONT=Courier New]IntLenINI = 0[/FONT]
[FONT=Courier New]e.Handled = [COLOR=blue]True[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]End[/COLOR] [COLOR=blue]If[/COLOR][/FONT]
[FONT=Courier New][COLOR=blue]End[/COLOR] [COLOR=blue]Sub[/COLOR][/FONT]
[COLOR=blue][FONT=Courier New]End[/FONT][/COLOR][FONT=Courier New] [COLOR=blue]Class[/COLOR][/FONT]
 
Last edited by a moderator:
Back
Top