I am trying to build an application for a psychology doctorate study. I'm using a MIDI project in C#. I want to open a form with a series of questions on it, frmQuestions. When frmQuestions loads, I want to show a form that displays the instructions. On this form I want a button for the user to confirm when they have finished reading the instructions. When this button is clicked I want it to close the Instruction form.
private void frmQuestions_Load(object sender, EventArgs e)
{
Form childForm = new Instructions();
childForm.MdiParent = this.ParentForm;
childForm.Show();
}
on the instruction form I have this code so far.
private void button1_Click(object sender, EventArgs e)
{
this.Close; //I tried this
this.Hide; // I tried this as well.
this.Parent.Show; //still not working.
}
I know I'm missing something obvious, any pointers would be helpful.
Loading
Brandon BaumPosted Feb 1, 2010, 12:29 AM
Now I run a timer to count down the response time the user has.
Form_Enter()
while(numbRunTimes <10)
{
RunExperiment();
}
RunExperiment()
{
numbRunTimes++;
xTimer.Start();
right = evaluateResponse();
reinforce = evaluateReinforce();
}
The idea is that when the form loads, the timer starts. After 5 seconds the user response is evaluated(did they press spacebar or not). We keep a running total of the right answers. Display updated values.
After the display is updated, I want it to wait 3 seconds before starting another 5 second wait for them to select their next response.
I continue to call the RunExperiment() until it has been run 10 times.
When I run it outside of debug mode, it shows up like it's already finished the experiment, even though the users hasn't had time to test it.
private void RunExperiment()
{
exp.shownCues++;
StopTime = 50000;
xTimer.Start();
this.lblTestNumber.Text = exp.shownCues.ToString() + "/" + C_TEST.ToString();
right = exp.IsSpaceCorrect(input);
if (right)
{
reinforce = exp.IsResponseReinforced();
this.lblCue.Hide();
this.lblScreen.ForeColor = System.Drawing.Color.Green;
this.lblScreen.Text = "OOO";
this.lblScreen.Show();
if (reinforce)
{
reward = reward + .25;
this.lblVal.Text = "$" + reward.ToString();
}
ResetCue();
}
else
{
this.lblCue.Hide();
this.lblScreen.ForeColor = System.Drawing.Color.Red;
this.lblScreen.Text = "XXX";
this.lblScreen.Show();
ResetCue();
}
}
private void ResetCue()
{
Wait();
this.lblScreen.Hide();
this.lblCue.Show();
}
private void Wait()
{
StartTime = 0;
StopTime = 30000;
xTimer.Start();
}
private void xTimer_Tick(object sender, System.EventArgs e)
{
while(StartTime< StopTime)
{
StartTime++;
}
xTimer.Stop();
RunExperiment();
}
private void Cue_Enter(object sender, EventArgs e)
{
while (exp.shownCues < C_TEST)
{
RunExperiment();
}
FinalWait();
}
Any ideas why it would skip the timers?