Click here to Skip to main content
15,887,485 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Help with Error Message Pin
GeorgieMPorgie5-Nov-12 5:03
GeorgieMPorgie5-Nov-12 5:03 
GeneralRe: Help with Error Message Pin
Wayne Gaylard5-Nov-12 18:31
professionalWayne Gaylard5-Nov-12 18:31 
QuestionUse Reportvier to Show Table with Unknown Number of Columns Pin
Member 76634803-Nov-12 15:03
Member 76634803-Nov-12 15:03 
AnswerRe: Use Reportvier to Show Table with Unknown Number of Columns Pin
Dave Kreskowiak4-Nov-12 4:25
mveDave Kreskowiak4-Nov-12 4:25 
AnswerRe: Use Reportvier to Show Table with Unknown Number of Columns Pin
Mycroft Holmes4-Nov-12 11:54
professionalMycroft Holmes4-Nov-12 11:54 
QuestionHow can i retrieve image to pictureBox ? Pin
heinhtataung1-Nov-12 18:04
heinhtataung1-Nov-12 18:04 
AnswerRe: How can i retrieve image to pictureBox ? Pin
Eddy Vluggen2-Nov-12 0:57
professionalEddy Vluggen2-Nov-12 0:57 
AnswerRe: How can i retrieve image to pictureBox ? Pin
SZLMCL6-Nov-12 23:20
SZLMCL6-Nov-12 23:20 
hy
This function converts byte array to image:

VB
Public Shared Function ByteArrayToImage(ByVal ByteArr() As Byte) As Object
                Dim ImageStream As System.IO.MemoryStream

                Try
                    If ByteArr.GetUpperBound(0) > 0 Then
                        ImageStream = New System.IO.MemoryStream(ByteArr)
                        Return Image.FromStream(ImageStream)
                    Else
                        Return Nothing
                    End If
                Catch ex As Exception
                    Return Nothing
                End Try
            End Function


and this convert back:

VB
Public Shared Function ImageToByteArray(ByVal NewImage As Image) As Object
               Dim ImageStream As System.IO.MemoryStream
               Dim ByteArr() As Byte

               Try
                   ReDim ByteArr(0)
                   If NewImage IsNot Nothing Then
                       ImageStream = New System.IO.MemoryStream
                       NewImage.Save(ImageStream, Imaging.ImageFormat.Jpeg)
                       ReDim ByteArr(CInt(ImageStream.Length - 1))
                       ImageStream.Position = 0
                       ImageStream.Read(ByteArr, 0, CInt(ImageStream.Length))
                   End If
                   Return ByteArr
               Catch ex As Exception
                   Return Nothing
               End Try
           End Function


+You need DBNull check when the column allow nulls.
QuestionHow can i save image in my N-tier application? Pin
heinhtataung31-Oct-12 20:20
heinhtataung31-Oct-12 20:20 
AnswerRe: How can i save image in my N-tier application? Pin
Eddy Vluggen1-Nov-12 3:05
professionalEddy Vluggen1-Nov-12 3:05 
QuestionAI program Pin
Casey Edison31-Oct-12 5:04
Casey Edison31-Oct-12 5:04 
AnswerRe: AI program Pin
Simon_Whale31-Oct-12 5:08
Simon_Whale31-Oct-12 5:08 
GeneralRe: AI program Pin
Casey Edison31-Oct-12 5:13
Casey Edison31-Oct-12 5:13 
AnswerRe: AI program Pin
Richard MacCutchan31-Oct-12 7:59
mveRichard MacCutchan31-Oct-12 7:59 
GeneralRe: AI program Pin
Casey Edison31-Oct-12 12:26
Casey Edison31-Oct-12 12:26 
GeneralRe: AI program Pin
Richard MacCutchan31-Oct-12 23:18
mveRichard MacCutchan31-Oct-12 23:18 
GeneralRe: AI program Pin
Casey Edison1-Nov-12 0:42
Casey Edison1-Nov-12 0:42 
GeneralRe: AI program Pin
Richard MacCutchan1-Nov-12 2:06
mveRichard MacCutchan1-Nov-12 2:06 
GeneralRe: AI program Pin
Casey Edison1-Nov-12 8:14
Casey Edison1-Nov-12 8:14 
GeneralRe: AI program Pin
Richard MacCutchan1-Nov-12 8:19
mveRichard MacCutchan1-Nov-12 8:19 
GeneralRe: AI program Pin
Casey Edison1-Nov-12 12:40
Casey Edison1-Nov-12 12:40 
GeneralRe: AI program Pin
Richard MacCutchan1-Nov-12 14:55
mveRichard MacCutchan1-Nov-12 14:55 
GeneralRe: AI program Pin
Casey Edison1-Nov-12 8:15
Casey Edison1-Nov-12 8:15 
GeneralRe: AI program Pin
Eddy Vluggen2-Nov-12 1:08
professionalEddy Vluggen2-Nov-12 1:08 
QuestionHow to INSERT multiple rows of data to sql table? Pin
zaimah31-Oct-12 1:28
zaimah31-Oct-12 1:28 

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.