Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

With VB 2008 something using the stream class

Posted on 2009-04-24
1
Medium Priority
?
288 Views
Last Modified: 2013-12-26
I am having trouble understanding how the stream can be read and data extracted to a fielded recordset.

Dim myStream As Stream = Nothing
        Dim openFileDialog1 As New OpenFileDialog()
 
        openFileDialog1.InitialDirectory = Application.StartupPath & \Data\
        openFileDialog1.Filter = "Icon files (*.ico|"
        openFileDialog1.FilterIndex = 2
        openFileDialog1.RestoreDirectory = True
 
        If openFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
            Try
                myStream = openFileDialog1.OpenFile()
                If (myStream IsNot Nothing) Then
                    ' Insert code to read the stream here. Here is the 
                'something like this?
              mydate = read(buffer, 1, 16) 
                End If
            Catch Ex As Exception
                MessageBox.Show("Cannot read file from disk. Original error: " & Ex.Message)
            Finally
                ' Check this again, since we need to make sure we didn't throw an exception on open.
                If (myStream IsNot Nothing) Then
                    myStream.Close()
                End If
 
 
 
            End Try
 
        End If

Open in new window

0
Comment
Question by:Jimmyjay21
1 Comment
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 24227059
You want to read the first 16 bytes?

                    Dim buffer(16) As Byte
                    myStream.Read(buffer, 0, buffer.Length)
                    ' ...now do something with "buffer"...
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

580 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question