Jump to content

andyman

Newbies
  • Posts

    2
  • Joined

  • Last visited

About andyman

  • Birthday 01/01/1970

andyman's Achievements

Newbie

Newbie (1/14)

  • First Post
  • Conversation Starter
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

0

Reputation

  1. Toolbox on the left. Drag and drop e.g. textbox, buttons, label, etc...
  2. Hello everybody! I want to save images in Paint.Net to my SQL database in image-fields. The problem I get is that the byte stream is not a valid image when I get it back from the database. The SaveForm and TransferPictures are classes I have implemented myself and they work fine. The problem can be the SaveToStream method I use in the Document class. Does anyone have an idea? The code is: private void menuFileSave_Click(object sender, System.EventArgs e) { SaveForm sf = new SaveForm(); sf.ShowDialog(); string fileName = sf.getFilename(); Stream stream = null; stream = (Stream)new FileStream(fileName, FileMode.Create, FileAccess.ReadWrite); stream = workspace.Document.SaveToStream1(stream, null); stream.Position = 0; byte[] fileByte = new byte[stream.Length]; int offset = 0; int remaining = fileByte.Length; stream.Read(fileByte, offset, remaining); TransferPictures trans = new TransferPictures(); trans.uploadFileToDatabase(fileByte, fileName); } Thanks!
×
×
  • Create New...