Click here to Skip to main content
15,919,613 members
Home / Discussions / Mobile
   

Mobile

 
Questionbluetooth printing Pin
Fer Simoes16-Sep-05 11:40
professionalFer Simoes16-Sep-05 11:40 
Questionports Pin
_tasleem15-Sep-05 22:48
_tasleem15-Sep-05 22:48 
AnswerRe: ports Pin
Fer Simoes16-Sep-05 11:43
professionalFer Simoes16-Sep-05 11:43 
GeneralRe: ports Pin
_tasleem16-Sep-05 19:35
_tasleem16-Sep-05 19:35 
Questionupdating Compact Framework Pin
David Menéndez Cisterna14-Sep-05 12:41
David Menéndez Cisterna14-Sep-05 12:41 
QuestionListBox Control key press event Pin
Sachin Xavier13-Sep-05 23:20
Sachin Xavier13-Sep-05 23:20 
QuestionMultiple checks of files during Debug Pin
Jim Berg13-Sep-05 9:49
Jim Berg13-Sep-05 9:49 
QuestionCompact Framework strange Exception Pin
David Menéndez Cisterna13-Sep-05 2:20
David Menéndez Cisterna13-Sep-05 2:20 
I've developed a simple C# program (for PocketPC), and It sometimes crashes with an unhandled exception... and I thing it is related to UI matters. The message is this:

Exception
Application::Run+0xf
Form1::Main+0xa

Mi application read info from serial port (from a GPS), with this event handler:

private void OnDataReceived(object sender, SerialDataReceivedEventArgs e) <br />
{ <br />
while(port != null && port.BytesToRead > 0) <br />
{ <br />
int Cnt = port.Read(portBuf, portPos, 1); <br />
<br />
if (Cnt != 0) <br />
{ <br />
//Read from input buffer <br />
if (portBuf[portPos] == '\n') <br />
{ <br />
string sentence = Encoding.ASCII.GetString(portBuf, 0, portPos-1); <br />
AddResult(sentence); <br />
<br />
portPos = 0; <br />
} <br />
else <br />
{ <br />
portPos++; <br />
} <br />
} <br />
} // while <br />
} <br />


After much investigation, now I am able to cause that exception by clicking a button. The code is this, simple one:

<br />
private void btnClosePort_Click(object sender, System.EventArgs e) <br />
{ <br />
Cursor.Current = Cursors.WaitCursor; <br />
<br />
// Wait for things to settle <br />
Thread.Sleep(1000); <br />
<br />
try <br />
{ <br />
  port.DataReceived -= new SerialDataReceivedEventHandler(OnDataReceived); <br />
  // Wait <br />
Thread.Sleep(1000); <br />
<br />
  port.Close(); <br />
  port.Dispose(); <br />
  port = null; <br />
} <br />
catch (Exception ex) <br />
{ <br />
  AddResult("-->Failure"); <br />
  AddResult(ex.ToString()); <br />
} <br />
<br />
Cursor.Current = Cursors.Default; <br />
<br />
AddResult("-->Closed"); <br />
} <br />


Notes: AddResult simple does add strings into a ListBox.

The really strange thing is this: if I remove the AddResult(sentence) call in "OnDataReceive", the exception is not thrown.

Could it be any bug related to UI ?
My hardware: iPAQ 2100 , Windows Mobile 2003 SE

Hope you can help me Smile | :)

Thanks to all!
QuestionFAX from Pocket PC ? Pin
mcdok12-Sep-05 4:37
mcdok12-Sep-05 4:37 
QuestionHelp me!!!!! Detecting change in data streams Pin
bulgaa12-Sep-05 3:06
bulgaa12-Sep-05 3:06 
QuestionMultiple Tables in a Dataset from multiple XML Files? Pin
maf66611-Sep-05 22:34
maf66611-Sep-05 22:34 
AnswerRe: Multiple Tables in a Dataset from multiple XML Files? Pin
cyberexel7-Dec-10 16:50
cyberexel7-Dec-10 16:50 
QuestionScreen Rotation Pin
George Papadopoulos11-Sep-05 22:07
George Papadopoulos11-Sep-05 22:07 
Questionactivate BT via code? Pin
Roger Alsing11-Sep-05 21:26
Roger Alsing11-Sep-05 21:26 
QuestionRe: activate BT via code? Pin
Jumba666623-Mar-06 9:49
Jumba666623-Mar-06 9:49 
AnswerRe: activate BT via code? Pin
Roger Alsing23-Mar-06 23:34
Roger Alsing23-Mar-06 23:34 
QuestionStartbar Pin
CSharpDavid9-Sep-05 6:42
CSharpDavid9-Sep-05 6:42 
QuestionOverload CompareItem to sort a ListBox Pin
Member 105720787-Sep-05 12:13
Member 105720787-Sep-05 12:13 
Questionset focus to next edit box Pin
sandem7-Sep-05 8:57
sandem7-Sep-05 8:57 
AnswerRe: set focus to next edit box Pin
João Paulo Figueira7-Sep-05 22:45
professionalJoão Paulo Figueira7-Sep-05 22:45 
GeneralRe: set focus to next edit box Pin
sandem8-Sep-05 2:04
sandem8-Sep-05 2:04 
GeneralRe: set focus to next edit box Pin
sandem13-Sep-05 8:34
sandem13-Sep-05 8:34 
QuestionDisplay multibyte character Pin
Member 21955836-Sep-05 14:46
Member 21955836-Sep-05 14:46 
QuestionWindows CE Emulator + VS2003 Pin
Stuart Ferguson 15-Sep-05 2:34
Stuart Ferguson 15-Sep-05 2:34 
QuestionActiveX Control in Windows CE Pin
LazarSidor31-Aug-05 22:46
LazarSidor31-Aug-05 22:46 

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.