Click here to Skip to main content
15,900,907 members
Home / Discussions / C#
   

C#

 
GeneralRe: hi.. Pin
musefan15-Jul-09 2:22
musefan15-Jul-09 2:22 
GeneralRe: hi.. Pin
Luc Pattyn15-Jul-09 2:25
sitebuilderLuc Pattyn15-Jul-09 2:25 
GeneralRe: hi.. Pin
musefan15-Jul-09 2:31
musefan15-Jul-09 2:31 
GeneralRe: hi.. Pin
Tom Deketelaere15-Jul-09 2:32
professionalTom Deketelaere15-Jul-09 2:32 
GeneralRe: hi.. Pin
Christian Graus15-Jul-09 2:48
protectorChristian Graus15-Jul-09 2:48 
GeneralRe: hi.. Pin
Tom Deketelaere15-Jul-09 2:53
professionalTom Deketelaere15-Jul-09 2:53 
GeneralRe: hi.. Pin
Luc Pattyn15-Jul-09 2:53
sitebuilderLuc Pattyn15-Jul-09 2:53 
GeneralRe: hi.. Pin
Tom Deketelaere15-Jul-09 3:04
professionalTom Deketelaere15-Jul-09 3:04 
QuestionAutomatic Email Sender Pin
dev sheoran15-Jul-09 1:41
dev sheoran15-Jul-09 1:41 
AnswerRe: Automatic Email Sender Pin
Not Active15-Jul-09 2:25
mentorNot Active15-Jul-09 2:25 
GeneralRe: Automatic Email Sender Pin
Manas Bhardwaj15-Jul-09 2:29
professionalManas Bhardwaj15-Jul-09 2:29 
GeneralRe: Automatic Email Sender Pin
Manas Bhardwaj15-Jul-09 2:38
professionalManas Bhardwaj15-Jul-09 2:38 
GeneralRe: Automatic Email Sender Pin
Not Active15-Jul-09 2:45
mentorNot Active15-Jul-09 2:45 
GeneralRe: Automatic Email Sender Pin
dev sheoran15-Jul-09 2:43
dev sheoran15-Jul-09 2:43 
GeneralRe: Automatic Email Sender Pin
Christian Graus15-Jul-09 2:50
protectorChristian Graus15-Jul-09 2:50 
AnswerRe: Automatic Email Sender Pin
Manas Bhardwaj15-Jul-09 2:29
professionalManas Bhardwaj15-Jul-09 2:29 
GeneralRe: Automatic Email Sender Pin
dev sheoran15-Jul-09 18:39
dev sheoran15-Jul-09 18:39 
Questionvbscript installation Pin
arkiboys15-Jul-09 0:28
arkiboys15-Jul-09 0:28 
AnswerRe: vbscript installation PinPopular
Christian Graus15-Jul-09 0:44
protectorChristian Graus15-Jul-09 0:44 
QuestionHow to convert an image to a Base64 string and back? Pin
Megidolaon15-Jul-09 0:06
Megidolaon15-Jul-09 0:06 
I want to store images in text form and later load them again.

I got this code to convert and image to a base64 string:
ImageConverter converter = new ImageConverter();
byte[] raw = new byte[1];
Bitmap test = new Bitmap(OFD_Open.FileName);

raw = (byte[])converter.ConvertTo(test, typeof(byte[]));

string output = Convert.ToBase64String(raw);
File.WriteAllText("image.txt", output);
And this code to convert it from a string back to an image
byte[] raw = new byte[1];
Bitmap pic = new Bitmap(1, 1);
raw = Convert.FromBase64String(OFD_Open.FileName);
PictureBox box = new PictureBox();

TypeConverter tc = TypeDescriptor.GetConverter(typeof(Bitmap));
pic = (Bitmap)tc.ConvertFrom(raw);
But the Convert.FromBase64String method throws an error, telling me there is an invalid character in the Base64 string.

What went wrong?
Thanks.
AnswerRe: How to convert an image to a Base64 string and back? Pin
SeMartens15-Jul-09 0:21
SeMartens15-Jul-09 0:21 
AnswerRe: How to convert an image to a Base64 string and back? Pin
Super Lloyd15-Jul-09 0:27
Super Lloyd15-Jul-09 0:27 
AnswerRe: How to convert an image to a Base64 string and back? Pin
Luc Pattyn15-Jul-09 2:08
sitebuilderLuc Pattyn15-Jul-09 2:08 
AnswerRe: How to convert an image to a Base64 string and back? Pin
Megidolaon15-Jul-09 7:30
Megidolaon15-Jul-09 7:30 
QuestionSmart Cards, what is the new PCSC? Pin
Dewald14-Jul-09 23:47
Dewald14-Jul-09 23:47 

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.