Moving Focus?

rjnewdotnet
12-08-2004, 05:18 PM
I am having a problem with moving back and forth between messageboxes and the executable.

How can I use a basic Mainmenu item and then when a message box appears to ask the user if they want to continue, it goes back to the original form. As of right now, it just closes the form from view and lets it sit in memory.

code example:
Case code :
Case 4
For i = 0 To 4 Step 1
grpcolAvg(i) = 0
colAvg = 0
For y = 0 To 3 Step 1
colAvg = grpArray(y, i) + colAvg
colLength = y + 1
Next
grpcolAvg(i) = colAvg / colLength
Next
If MessageBox.Show("The Average of Column 1: " & grpcolAvg(0) & ControlChars.NewLine & "The Average of Column 2: " & grpcolAvg(1) _
& ControlChars.NewLine & "The Average of Column 3: " & grpcolAvg(2) & ControlChars.NewLine _
& "The Average of Column 4: " & grpcolAvg(3) & ControlChars.NewLine & "The Average of Column 5: " & grpcolAvg(4) & ControlChars.NewLine & ControlChars.NewLine & "Continue Application?", "Exit Application", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) = DialogResult.Yes Then

Exit Sub

Else
Me.Close()
End If


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



Thanks in advance,
RJ :confused:

excaliber
12-08-2004, 05:40 PM
It means you have other objects in memory that are keeping it from closing. Any other forms? Threading?

Instead of Me.Close, use Me.Dispose.

rjnewdotnet
12-08-2004, 07:19 PM
if i use that control during debugging it works fine.

it cant be that, I also use that on the Exit portion of the menu and it has no problems even after compile.

RJ

rjnewdotnet
12-08-2004, 07:24 PM
Sorry I probably arent aking the right questions. Maybe I should re-frame what I am looking for:

I have the code:
Case 4
For i = 0 To 4 Step 1
grpcolAvg(i) = 0
colAvg = 0
For y = 0 To 3 Step 1
colAvg = grpArray(y, i) + colAvg
colLength = y + 1
Next
grpcolAvg(i) = colAvg / colLength
Next
If MessageBox.Show("The Average of Column 1: " & grpcolAvg(0) & ControlChars.NewLine & "The Average of Column 2: " & grpcolAvg(1) _
& ControlChars.NewLine & "The Average of Column 3: " & grpcolAvg(2) & ControlChars.NewLine _
& "The Average of Column 4: " & grpcolAvg(3) & ControlChars.NewLine & "The Average of Column 5: " & grpcolAvg(4) & ControlChars.NewLine & ControlChars.NewLine & "Continue Application?", "Exit Application", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) = DialogResult.Yes Then

Exit Sub

Else
Me.Close()
End If

How do I get back to a form control from here?
I need to move back to the form and close the messagebox upon click of yes by user.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum