Click here to Skip to main content
15,895,848 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: giving permissions to user to access file in vb.net 2.0 Pin
Dave Kreskowiak3-Apr-08 3:17
mveDave Kreskowiak3-Apr-08 3:17 
GeneralRe: giving permissions to user to access file in vb.net 2.0 Pin
vijaylumar3-Apr-08 18:40
vijaylumar3-Apr-08 18:40 
GeneralRe: giving permissions to user to access file in vb.net 2.0 Pin
Dave Kreskowiak4-Apr-08 1:43
mveDave Kreskowiak4-Apr-08 1:43 
Questiongiving permissions to user to write/read the files Pin
vijaylumar2-Apr-08 1:02
vijaylumar2-Apr-08 1:02 
GeneralRe: giving permissions to user to write/read the files Pin
Dave Kreskowiak2-Apr-08 3:38
mveDave Kreskowiak2-Apr-08 3:38 
Generalfor CrystalReport Pin
Krazy Programmer2-Apr-08 0:13
Krazy Programmer2-Apr-08 0:13 
GeneralConvert an Image, encoded in hex, back to an image file Pin
ESTAN2-Apr-08 0:12
ESTAN2-Apr-08 0:12 
GeneralRe: Convert an Image, encoded in hex, back to an image file Pin
ESTAN2-Apr-08 0:41
ESTAN2-Apr-08 0:41 
I think i have found it. Searching hard and trying end up with nothing, asking help and the answers suddenly comes.

O well, here i'll give you the solution. (Remind that the hex value is just a part of whole string)

<br />
Private Sub ConvertImg()<br />
        Dim hexvalue As String = "FFD8FFE000104A46494600010101000100010000..."<br />
        Dim bytevalue As Byte() = HexToBin(hexvalue)<br />
        Dim myFileStream As FileStream<br />
        Dim intByte As Integer = 0<br />
        Dim lngLoop As Long<br />
<br />
        Try<br />
            intByte = bytevalue.Length<br />
            myFileStream = File.OpenWrite("c:\image.jpg")<br />
<br />
            For lngLoop = 0 To intByte - 1<br />
                myFileStream.WriteByte(bytevalue(lngLoop))<br />
            Next<br />
<br />
            myFileStream.Close()<br />
        Catch ex As IOException<br />
            MessageBox.Show(ex.Message)<br />
        End Try<br />
    End Sub<br />
<br />
<br />
    '---------------------------------------------------------------------------<br />
    '<br />
    '  Function:	HexToBin()<br />
    '  Input:	s<br />
    '  Return:	bytes<br />
    '  Purpose:	Converts Hex to binary<br />
    '		<br />
    '---------------------------------------------------------------------------<br />
    Public Shared Function HexToBin(ByVal s As String) As Byte()<br />
        Dim arraySize As Integer = CInt(s.Length / 2)<br />
        Dim bytes(arraySize - 1) As Byte<br />
        Dim counter As Integer<br />
        For i As Integer = 0 To s.Length - 1 Step 2<br />
            Dim hexValue As String = s.Substring(i, 2)<br />
<br />
            ' Tell convert to interpret the string as a 16 bit hex value  <br />
            Dim intValue As Integer = Convert.ToInt32(hexValue, 16)<br />
            ' Convert the integer to a byte and store it in the array  <br />
            bytes(counter) = Convert.ToByte(intValue)<br />
            counter += 1<br />
        Next<br />
        Return bytes<br />
    End Function<br />

GeneralRe: Convert an Image, encoded in hex, back to an image file Pin
Luc Pattyn2-Apr-08 0:55
sitebuilderLuc Pattyn2-Apr-08 0:55 
GeneralArray to listbox an back to an array Pin
Fatboy581-Apr-08 23:58
Fatboy581-Apr-08 23:58 
GeneralRe: Array to listbox an back to an array Pin
Luc Pattyn2-Apr-08 0:59
sitebuilderLuc Pattyn2-Apr-08 0:59 
GeneralRe: Array to listbox an back to an array Pin
Fatboy582-Apr-08 1:15
Fatboy582-Apr-08 1:15 
GeneralRe: Array to listbox an back to an array Pin
Luc Pattyn2-Apr-08 1:18
sitebuilderLuc Pattyn2-Apr-08 1:18 
GeneralRe: Array to listbox an back to an array Pin
Fatboy582-Apr-08 1:24
Fatboy582-Apr-08 1:24 
GeneralRe: Array to listbox an back to an array Pin
Luc Pattyn2-Apr-08 1:29
sitebuilderLuc Pattyn2-Apr-08 1:29 
Generaldatabase display in windows application Pin
tanya20011-Apr-08 23:05
tanya20011-Apr-08 23:05 
GeneralRe: database display in windows application Pin
Vimalsoft(Pty) Ltd2-Apr-08 2:38
professionalVimalsoft(Pty) Ltd2-Apr-08 2:38 
GeneralConverting Msflexgrid content to Excel Pin
aaraaayen1-Apr-08 20:30
aaraaayen1-Apr-08 20:30 
GeneralRe: Converting Msflexgrid content to Excel Pin
Dave Kreskowiak2-Apr-08 3:34
mveDave Kreskowiak2-Apr-08 3:34 
Questionweb service access control Pin
Ismaeel1-Apr-08 16:08
Ismaeel1-Apr-08 16:08 
GeneralRe: web service access control Pin
Dave Kreskowiak2-Apr-08 3:32
mveDave Kreskowiak2-Apr-08 3:32 
GeneralFind PivotTable in Excel Pin
Bomb_shell1-Apr-08 9:58
Bomb_shell1-Apr-08 9:58 
GeneralRe: Find PivotTable in Excel Pin
ne0h1-Apr-08 19:56
ne0h1-Apr-08 19:56 
GeneralRe: Find PivotTable in Excel Pin
Mitch F.1-Apr-08 20:15
Mitch F.1-Apr-08 20:15 
GeneralRe: Find PivotTable in Excel Pin
Bomb_shell2-Apr-08 15:14
Bomb_shell2-Apr-08 15:14 

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.