Click here to Skip to main content
15,886,799 members
Home / Discussions / C#
   

C#

 
Questioncombobox.datasource question Pin
udikantz27-Aug-07 15:27
udikantz27-Aug-07 15:27 
AnswerRe: combobox.datasource question Pin
mihirhp27-Aug-07 20:28
mihirhp27-Aug-07 20:28 
GeneralRe: combobox.datasource question Pin
udikantz27-Aug-07 21:18
udikantz27-Aug-07 21:18 
GeneralRe: combobox.datasource question Pin
mihirhp27-Aug-07 22:24
mihirhp27-Aug-07 22:24 
QuestionActive Directory Pin
T4AMD27-Aug-07 14:08
T4AMD27-Aug-07 14:08 
AnswerRe: Active Directory Pin
ekynox27-Aug-07 15:52
ekynox27-Aug-07 15:52 
Questionnull exception while passing a serial port instance to an object Pin
murr00727-Aug-07 13:21
murr00727-Aug-07 13:21 
AnswerRe: null exception while passing a serial port instance to an object Pin
Luc Pattyn27-Aug-07 14:41
sitebuilderLuc Pattyn27-Aug-07 14:41 
Hi,

SerialPort is a class, hence a reference type.

You can declare SerialPort references as much as you like, and copy them,
and pass them from one object to another; but you can only create SerialPort
instances (i.e. real objects) by using the "new" keyword.

"new" is not present in the code you have shown, if it is not there at all
then anything you try to do to serialPort1 is doomed to fail with a
NullReferenceException.

Also relevant could be the following MSDN remark on SerialPort.Open:
"The best practice for any application is to wait for some amount of time after
calling the Close method before attempting to call the Open method, as the port
may not be closed instantly."

Since they don't specify "some amount of time" this is not very practical;
the better approach may be to open the port only once.

Smile | :)


Luc Pattyn [Forum Guidelines] [My Articles]


this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google


GeneralRe: null exception while passing a serial port instance to an object Pin
murr00727-Aug-07 15:56
murr00727-Aug-07 15:56 
GeneralRe: null exception while passing a serial port instance to an object Pin
Luc Pattyn27-Aug-07 17:02
sitebuilderLuc Pattyn27-Aug-07 17:02 
QuestionHow can I prohibit writing a characters? Pin
daavena27-Aug-07 10:51
daavena27-Aug-07 10:51 
AnswerRe: How can I prohibit writing a characters? Pin
Pete O'Hanlon27-Aug-07 11:18
mvePete O'Hanlon27-Aug-07 11:18 
GeneralRe: How can I prohibit writing a characters? Pin
daavena27-Aug-07 11:35
daavena27-Aug-07 11:35 
GeneralRe: How can I prohibit writing a characters? Pin
Yitzchok Dev27-Aug-07 12:56
Yitzchok Dev27-Aug-07 12:56 
GeneralRe: How can I prohibit writing a characters? Pin
daavena28-Aug-07 10:28
daavena28-Aug-07 10:28 
QuestionUTF-8 characters in RichTextBox with SelectedRtf... Pin
Paradox2227-Aug-07 10:00
Paradox2227-Aug-07 10:00 
QuestionIUPnPDeviceFinder Pin
MicealG27-Aug-07 9:53
MicealG27-Aug-07 9:53 
AnswerRe: IUPnPDeviceFinder Pin
Mark Churchill27-Aug-07 15:34
Mark Churchill27-Aug-07 15:34 
GeneralRe: IUPnPDeviceFinder Pin
MicealG28-Aug-07 5:38
MicealG28-Aug-07 5:38 
QuestionAdvanced Typed Dataset Pin
hamid_m27-Aug-07 9:42
hamid_m27-Aug-07 9:42 
QuestionSerial Keys. Make trial version. Examples ? Pin
finayev27-Aug-07 9:40
finayev27-Aug-07 9:40 
AnswerRe: Serial Keys. Make trial version. Examples ? Pin
Spacix One27-Aug-07 10:14
Spacix One27-Aug-07 10:14 
QuestionAdding "%" at the end of text in a textbox Pin
basi001427-Aug-07 9:22
basi001427-Aug-07 9:22 
AnswerRe: Adding "%" at the end of text in a textbox Pin
keyboard warrior27-Aug-07 9:24
keyboard warrior27-Aug-07 9:24 
GeneralRe: Adding "%" at the end of text in a textbox Pin
basi001427-Aug-07 9:32
basi001427-Aug-07 9:32 

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.