Click here to Skip to main content
15,920,956 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questionconvert anynumber to text [modified] Pin
playout7-Aug-07 7:52
playout7-Aug-07 7:52 
AnswerRe: convert anynumber to text Pin
Hessam Jalali7-Aug-07 8:19
Hessam Jalali7-Aug-07 8:19 
AnswerRe: convert anynumber to text Pin
Guffa7-Aug-07 9:36
Guffa7-Aug-07 9:36 
AnswerRe: convert anynumber to text Pin
The ANZAC7-Aug-07 10:49
The ANZAC7-Aug-07 10:49 
QuestionData Conversion issue Pin
Cory Kimble7-Aug-07 6:00
Cory Kimble7-Aug-07 6:00 
AnswerRe: Data Conversion issue Pin
Luc Pattyn7-Aug-07 6:33
sitebuilderLuc Pattyn7-Aug-07 6:33 
GeneralRe: Data Conversion issue Pin
Cory Kimble7-Aug-07 6:58
Cory Kimble7-Aug-07 6:58 
GeneralRe: Data Conversion issue Pin
Luc Pattyn7-Aug-07 7:16
sitebuilderLuc Pattyn7-Aug-07 7:16 
Hi Cory,

you are confusing hexadecimal with decimal, and binary with text.
also your sequence of &H1 does not fit the needs.

31 30 30 and 30, when taken as hex numbers are the values of the ASCII characters 1 0 0 and 0.
Hence you want to send the text string 1000 here. Your code does not do that at all.

So it sounds like you want to send a big string consisting of:
- maybe some initial characters or bytes indicating the start
- then for each field: a starting char or byte, followed by the string representing the value
- maybe some final characters or bytes indicating the end

If all chosen delimiters were printable characters, it would be a plain text application,
and you could solve it with string concatenation, then a single "write string".

If you really need non-printable chars/bytes in between the fields, you can go two ways:

- try to come up with a byte array that contains all; that's the hard way, which you are
attempting right now
- just issue a couple of SerialPort.Write methods, something like (pseudo-code !):

port.Write(aByteArrayIndicatingStart,0,itsLength)               ' that is binary operation
for every field:
    port.Write(aByteArrayIndicatingFieldSeparator,0,itsLength)  ' that is binary operation
    port.Write(field.ToString()                                 ' that is text operation
port.Write(aByteArrayIndicatingEnd,0,itsLength)                 ' that is binary operation


Hope this helps.





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


QuestionHow do I ping another computer? Pin
Rossx7-Aug-07 5:49
Rossx7-Aug-07 5:49 
AnswerRe: How do I ping another computer? Pin
Luc Pattyn7-Aug-07 5:56
sitebuilderLuc Pattyn7-Aug-07 5:56 
GeneralRe: How do I ping another computer? Pin
originSH7-Aug-07 6:16
originSH7-Aug-07 6:16 
GeneralRe: How do I ping another computer? Pin
Luc Pattyn7-Aug-07 6:35
sitebuilderLuc Pattyn7-Aug-07 6:35 
GeneralRe: How do I ping another computer? Pin
'Drew7-Aug-07 7:12
'Drew7-Aug-07 7:12 
GeneralRe: How do I ping another computer? Pin
Luc Pattyn7-Aug-07 7:48
sitebuilderLuc Pattyn7-Aug-07 7:48 
GeneralRe: How do I ping another computer? Pin
'Drew7-Aug-07 7:54
'Drew7-Aug-07 7:54 
GeneralRe: How do I ping another computer? Pin
Luc Pattyn7-Aug-07 13:23
sitebuilderLuc Pattyn7-Aug-07 13:23 
QuestionMoving Text (marquee) in vb.net form Pin
Charanjot Singh7-Aug-07 4:06
Charanjot Singh7-Aug-07 4:06 
AnswerRe: Moving Text (marquee) in vb.net form Pin
Luc Pattyn7-Aug-07 4:16
sitebuilderLuc Pattyn7-Aug-07 4:16 
QuestionNo connection could be made because the target machine actively refused it Pin
Daniel_Logan7-Aug-07 3:51
Daniel_Logan7-Aug-07 3:51 
GeneralRe: No connection could be made because the target machine actively refused it Pin
Guffa7-Aug-07 4:41
Guffa7-Aug-07 4:41 
AnswerRe: No connection could be made because the target machine actively refused it Pin
Dave Kreskowiak7-Aug-07 12:25
mveDave Kreskowiak7-Aug-07 12:25 
QuestionWant to set app(Application path) Pin
Charanjot Singh7-Aug-07 3:27
Charanjot Singh7-Aug-07 3:27 
AnswerRe: Want to set app(Application path) Pin
Hessam Jalali7-Aug-07 8:27
Hessam Jalali7-Aug-07 8:27 
QuestionFlex grid Pin
kankeyan7-Aug-07 2:14
kankeyan7-Aug-07 2:14 
AnswerRe: Flex grid Pin
Nilesh Hapse7-Aug-07 2:27
Nilesh Hapse7-Aug-07 2:27 

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.