Click here to Skip to main content
15,899,475 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionHow to Control Concurency using Threads in vb.net Pin
Vimalsoft(Pty) Ltd19-Dec-07 23:17
professionalVimalsoft(Pty) Ltd19-Dec-07 23:17 
AnswerRe: How to Control Concurency using Threads in vb.net Pin
Dave Kreskowiak20-Dec-07 7:56
mveDave Kreskowiak20-Dec-07 7:56 
QuestionBitmap&Bitmap Pin
The real $M@19-Dec-07 22:22
The real $M@19-Dec-07 22:22 
GeneralRe: Bitmap&Bitmap Pin
Christian Graus19-Dec-07 23:26
protectorChristian Graus19-Dec-07 23:26 
GeneralRe: Bitmap&Bitmap Pin
The real $M@20-Dec-07 23:36
The real $M@20-Dec-07 23:36 
GeneralRe: Bitmap&Bitmap Pin
MikeMarq20-Dec-07 11:24
MikeMarq20-Dec-07 11:24 
GeneralRe: Bitmap&Bitmap Pin
The real $M@20-Dec-07 23:35
The real $M@20-Dec-07 23:35 
GeneralRe: Bitmap&Bitmap Pin
MikeMarq21-Dec-07 8:44
MikeMarq21-Dec-07 8:44 
A few notes. This will compare 2 files of ANY format not just bitmaps. path1 and path2 are your file paths. This will only work if the files are the same format(if you compare a 32 bit and 24 bit bitmap it will always return false). Also I have not tested this but I think it is correct but if you get an error or problem just let me know. I don't think there is much overhead with filestreams but if it isn't real fast then try using the read command at the bottom to read it into arrays then compare the arrays instead of the filestreams. If you need to compare different formats or if you are looking for a way to get or set pixels then I know how to do that but it is a little more involved than this since you have to match up pixels and so forth and it requires some knowledge of the bitmap format.



    Public Function CompareFiles(ByVal path1 As String, ByVal path2 As String) As Boolean<br />
        Dim n As Integer, issame As Boolean = True, fstream1 As IO.FileStream, fstream2 As IO.FileStream<br />
<br />
        'create streams<br />
        fstream1 = New IO.FileStream(path1, IO.FileMode.Open, IO.FileAccess.Read)<br />
        fstream2 = New IO.FileStream(path2, IO.FileMode.Open, IO.FileAccess.Read)<br />
<br />
        'compares the streams<br />
        If fstream1.Length = fstream2.Length Then<br />
            For n = 0 To fstream1.Length<br />
                If fstream1.ReadByte <> fstream2.ReadByte Then<br />
                    issame = False<br />
                    Exit For<br />
                End If<br />
            Next<br />
        Else<br />
            issame = False<br />
        End If<br />
<br />
        fstream1.Close()<br />
        fstream2.Close()<br />
<br />
        Return issame<br />
    End Function




The file stream is basically like an array of bytes. You can manipulate any file with file streams and if you want to copy data to or from an array use these commands.


fstream1.Read(yourarray, youroffset, yourcount)<br />
fstream1.Write(yourarray, youroffset, yourcount)

AnswerRe: Bitmap&Bitmap Pin
The real $M@22-Dec-07 1:54
The real $M@22-Dec-07 1:54 
GeneralException for DB connection Pin
nishkarsh_k19-Dec-07 21:10
nishkarsh_k19-Dec-07 21:10 
GeneralRe: Exception for DB connection Pin
Christian Graus19-Dec-07 23:27
protectorChristian Graus19-Dec-07 23:27 
GeneralRe: Exception for DB connection Pin
nishkarsh_k20-Dec-07 7:59
nishkarsh_k20-Dec-07 7:59 
GeneralRe: Exception for DB connection Pin
yogesh_kumar_agarwal20-Dec-07 3:16
yogesh_kumar_agarwal20-Dec-07 3:16 
GeneralRe: Exception for DB connection Pin
nishkarsh_k20-Dec-07 8:04
nishkarsh_k20-Dec-07 8:04 
GeneralPLEASE HELP!! craxdrt.dll failed to register [modified] Pin
vbDigger'z19-Dec-07 21:10
vbDigger'z19-Dec-07 21:10 
AnswerRe: PLEASE HELP!! craxdrt.dll failed to register Pin
yogesh_kumar_agarwal20-Dec-07 3:40
yogesh_kumar_agarwal20-Dec-07 3:40 
GeneralRe: PLEASE HELP!! craxdrt.dll failed to register Pin
vbDigger'z20-Dec-07 14:32
vbDigger'z20-Dec-07 14:32 
GeneralReading CSV File and storing in dataset Pin
ejaz_pk19-Dec-07 6:18
ejaz_pk19-Dec-07 6:18 
GeneralRe: Reading CSV File and storing in dataset Pin
Johan Hakkesteegt19-Dec-07 6:46
Johan Hakkesteegt19-Dec-07 6:46 
GeneralRe: Reading CSV File and storing in dataset Pin
ejaz_pk19-Dec-07 19:23
ejaz_pk19-Dec-07 19:23 
GeneralRe: Reading CSV File and storing in dataset Pin
Scott Dorman23-Dec-07 1:57
professionalScott Dorman23-Dec-07 1:57 
GeneralSplitting MDI form Pin
supercat919-Dec-07 5:46
supercat919-Dec-07 5:46 
GeneralRe: Splitting MDI form Pin
Dave Kreskowiak20-Dec-07 8:24
mveDave Kreskowiak20-Dec-07 8:24 
QuestionDirectory Tree contorl failing on folders with access constraints Pin
ExcelMonkey19-Dec-07 5:10
ExcelMonkey19-Dec-07 5:10 
GeneralRe: Directory Tree contorl failing on folders with access constraints Pin
Johan Hakkesteegt19-Dec-07 7:36
Johan Hakkesteegt19-Dec-07 7:36 

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.