Click here to Skip to main content
15,896,063 members
Home / Discussions / C#
   

C#

 
AnswerRe: Can someone help me to find the equivalent Linq expressions? Pin
Michael Sync10-Jul-08 16:20
Michael Sync10-Jul-08 16:20 
Questionevents adding and removing Pin
netJP12L10-Jul-08 5:49
netJP12L10-Jul-08 5:49 
AnswerRe: events adding and removing Pin
Thomas Stockwell10-Jul-08 10:35
professionalThomas Stockwell10-Jul-08 10:35 
AnswerRe: events adding and removing Pin
PIEBALDconsult10-Jul-08 11:33
mvePIEBALDconsult10-Jul-08 11:33 
Questionmessagebox does not stop [modified] Pin
scalpabob10-Jul-08 5:47
scalpabob10-Jul-08 5:47 
AnswerRe: message box does not stop Pin
DaveyM6910-Jul-08 8:35
professionalDaveyM6910-Jul-08 8:35 
GeneralRe: messagebox does not stop [modified] Pin
scalpabob10-Jul-08 20:36
scalpabob10-Jul-08 20:36 
GeneralRe: messagebox does not stop [modified] Pin
scalpabob11-Jul-08 3:38
scalpabob11-Jul-08 3:38 
Hi there,

I could still not make it work.
What I noticed is that if I display a messagebox in my keypress event when I run the code the messagebox displays then disappears without human intervention but the next messagebox does not?

I had to put two messageboxes one after the other in order to achieve my goal.
Pretty ugly I admit. I am missing some fundamental understanding somewhere.
I am running the code on an psion 8515, Compact Framework 3.5, OS windows CE.NET version 5.

Here is the code for anyone interested

private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
try
{
if (e.KeyChar == (char)Keys.Return) // Catch carriage return from barcode
{
MessageBox.Show(""); // do not delete. I do not understand why but if we remove this event then the next message box does not stop.
e.Handled = true;
this.lblBarCode.Text = textBox1.Text.Trim();

if (validate_data(lblBarCode.Text) == false)
{
this.textBox1.Enabled = false;
switch(MessageBox.Show(" BarCode does not match, Accept BarCode ?",
"Validate BarCode", MessageBoxButtons.YesNo,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button1))

{
case DialogResult.Yes:
// TODO write to output file, don't forget system date !!
MessageBox.Show("Yes ");
break;

case DialogResult.No:
MessageBox.Show("No ");
// TODO ignore input tidy up
break;
}
}
else
{
// TODO write to output file, don't forget system date !!
}
}
}
catch (Exception z)
{
MessageBox.Show("Error in btnOpenSort_Click" + z);
}
}

private Boolean validate_data(string scannedData)
{
try
{
int i = 0;
string lineData;
lineData = this.lstBoxFiles.SelectedItem.ToString();
i = lineData.IndexOf("-") + 1;
lineData = lineData.Substring(i);

if (lineData != scannedData)
return false;
else
return true;
}
catch (Exception z)
{
MessageBox.Show("Error in validate_data " + z);
return false;
}
}


Thank you,
Scalpabob

modified on Friday, July 11, 2008 9:57 AM

GeneralRe: messagebox does not stop Pin
DaveyM6914-Jul-08 12:20
professionalDaveyM6914-Jul-08 12:20 
GeneralRe: messagebox does not stop Pin
scalpabob17-Aug-08 22:16
scalpabob17-Aug-08 22:16 
GeneralRe: messagebox does not stop Pin
DaveyM6918-Aug-08 8:11
professionalDaveyM6918-Aug-08 8:11 
Questionxml Pin
arkiboys10-Jul-08 5:03
arkiboys10-Jul-08 5:03 
AnswerRe: xml Pin
Ravi Bhavnani10-Jul-08 6:20
professionalRavi Bhavnani10-Jul-08 6:20 
QuestionRead specific cells in Excel Pin
kallileo10-Jul-08 4:47
kallileo10-Jul-08 4:47 
AnswerRe: Read specific cells in Excel Pin
led mike10-Jul-08 4:54
led mike10-Jul-08 4:54 
QuestionDetect NULL values before trying to AVG data Pin
scjsb10-Jul-08 4:15
scjsb10-Jul-08 4:15 
AnswerRe: Detect NULL values before trying to AVG data Pin
vkuttyp10-Jul-08 5:05
professionalvkuttyp10-Jul-08 5:05 
QuestionProblem Starting Windows Service Automatically Pin
karthi8410-Jul-08 3:45
karthi8410-Jul-08 3:45 
AnswerRe: Problem Starting Windows Service Automatically Pin
PIEBALDconsult10-Jul-08 4:03
mvePIEBALDconsult10-Jul-08 4:03 
GeneralRe: Problem Starting Windows Service Automatically Pin
karthi8411-Jul-08 3:06
karthi8411-Jul-08 3:06 
AnswerRe: Problem Starting Windows Service Automatically Pin
DaveyM6910-Jul-08 8:44
professionalDaveyM6910-Jul-08 8:44 
GeneralRe: Problem Starting Windows Service Automatically Pin
karthi8411-Jul-08 3:06
karthi8411-Jul-08 3:06 
QuestionValue in long pointer resets after a stackalloc Pin
Campden BRI Developers10-Jul-08 3:34
Campden BRI Developers10-Jul-08 3:34 
QuestionConcept of digital signing -help Pin
Emil Müller10-Jul-08 3:30
Emil Müller10-Jul-08 3:30 
AnswerRe: Concept of digital signing -help Pin
Simon P Stevens10-Jul-08 3:40
Simon P Stevens10-Jul-08 3:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.