Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
|
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 5th, 2003, 02:36 PM
Authorized User
 
Join Date: Oct 2003
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default String to Binary, Binary to String

I am trying write a function to convert a string value to a binary value and then another function to convert it back to string. I have looked into the BinaryWriter and BinaryReader but I can only find examples of using a FileStream.

Can anyone help.

 
Old November 5th, 2003, 02:42 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Can you provide an example of what you want to do?

BinaryWriter/Reader are for dealing with binary type data, but I think you mean converting a string (of what?) to 010101001110001101010.

Peter
------------------------------------------------------
Work smarter, not harder.
 
Old November 5th, 2003, 04:14 PM
Authorized User
 
Join Date: Oct 2003
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Fuction strTObinary (ByVal str as String) as String
'''I want binary value of variable str. For instance 01010101010101
'''Then I want to cast that value to a string. For instance binaryVal = "0101010101"
end Fuction

Fuction binaryTOstr (ByVal binaryVal as string) as ??Binary Type???
'''take binaryVal and cast it to the binary type which I have no idea what that is
'''take the now true binary value and convert it to its actual string value.
'''For instance, 010101010101 to "This is my string"
end Fuction



 
Old November 5th, 2003, 05:02 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Ok, I think I see what you are trying to do. To the best of my knowledge, there is no "Binary" type. I mean... technically all data types are binary in their raw form, after all that's what the processor is using. But I don't think there is really a binary data type. You could take a character, figure out its ascii code and convert that integer to a string containing 1s and 0s to present the "binary" representation of that character.

What is intent for these functions? Given that there is no binary basic data type there seems to be little you could do with this.

Peter
------------------------------------------------------
Work smarter, not harder.





Similar Threads
Thread Thread Starter Forum Replies Last Post
string to binary conversion in XSLT navi25584 XSLT 5 September 3rd, 2008 03:14 AM
String or binary data would be truncated spiffyaldo2 ASP.NET 1.0 and 1.1 Basics 1 March 21st, 2006 08:49 AM
File to binary and save as string eelisMX Pro VB.NET 2002/2003 4 December 8th, 2004 10:26 AM
decimal string to binary se7ss C# 5 July 19th, 2004 02:52 PM
String or binary data would be truncated. Cinderella Classic ASP Basics 3 June 5th, 2004 04:36 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.