Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

 

I am trying to figue out the easiest way to store files of any type in a database and then display them in a VB .net application. The concept sounds simple, but I have not been able to find a solution yet. I would be incredibly grateful for any feedback.

Posted
Hi,

 

I am trying to figue out the easiest way to store files of any type in a database and then display them in a VB .net application. The concept sounds simple, but I have not been able to find a solution yet. I would be incredibly grateful for any feedback.

search for saving images to a database, its no different.

Joe Mamma

Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized.

Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.

Posted (edited)
search for saving images to a database' date=' its no different.[/quote']

 

 

Thanks for your help Joe Mamma. I have attached a project (from planet source code) that I am trying to modify for my needs. It currently loads pictures into a picturebox on the from an Access DB. What I am trying to do is it to load an .rtf file from the Access DB into a richtextbox instead. The code I can't figue out is as follows:

 

Private Sub LoadImage(ByVal recNo As Integer, ByVal dirn As Direction)
       Dim arr() As Byte

       Select Case dirn
           Case Direction.NextImage
               If recNo <= ds.Tables(0).Rows.Count - 1 Then
                   lblCount.Text = Val(lblCount.Text) + 1
               Else
                   Exit Sub
               End If
           Case Direction.PreviousImage
               If recNo > 0 Then
                   lblCount.Text = Val(lblCount.Text) - 1
                   recNo = recNo - 1
               Else
                   Exit Sub
               End If
       End Select

       arr = ds.Tables(0).Rows(recNo).Item(0)
[b]
       '+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
       'How can I load the OLE object into the RichTextBox instead of a picture box?[/b]
     [color=Red]  picLoad.Image = picLoad.Image.FromStream(New IO.MemoryStream(arr))
[/color][b]
       '???????????
       '++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

[/b]
       'NOTE: If you want to save the image to a file, you can use the following code:
       'FileOpen(1, "filename", OpenMode.Binary)
       'FilePut(1, arr)
       'FileClose(1)
   End Sub

 

I would think it would be something like:

 

[color=Red]richtextbox1.text = richtextbox.text.FromStream(New IO.MemoryStream(arr))[/color]

 

But that doesn't seem to work

 

Thanks Again,

CementBoot

DB.zip

Edited by PlausiblyDamp

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...