FileGet in VB.Net not returning the same results as in Access
-
Hi I'm in the process of rewriting a access database type of application, but I run into a problem. This is the Access VB code. dn = FreeFile Open matrix For Binary Access Read As #dn Get #dn, dsn, km Close #dn This the VB.Net code FileNumber = FreeFile() FileOpen(FileNumber, filepath, OpenMode.Binary, OpenAccess.Read, OpenShare.Shared) FileGet(FileNumber, FindValue) To start, I don't none the structure of the file. I'm sending in a search value which should return a result. The VB.Net function isn't returning the same value as the Access VB function. Any ideas why its happening would be appreciated!. Thanks Regardt Africa is a tough country --"Hello daar vir die Afrikaans sprekende"--
-
Hi I'm in the process of rewriting a access database type of application, but I run into a problem. This is the Access VB code. dn = FreeFile Open matrix For Binary Access Read As #dn Get #dn, dsn, km Close #dn This the VB.Net code FileNumber = FreeFile() FileOpen(FileNumber, filepath, OpenMode.Binary, OpenAccess.Read, OpenShare.Shared) FileGet(FileNumber, FindValue) To start, I don't none the structure of the file. I'm sending in a search value which should return a result. The VB.Net function isn't returning the same value as the Access VB function. Any ideas why its happening would be appreciated!. Thanks Regardt Africa is a tough country --"Hello daar vir die Afrikaans sprekende"--
What is returned all depends on the data type of the variable you are reading this data into. If you define FindValue as an Integer, VB.NET will read the first 4 bytes of the file into FileValue. If your defined FindValue at a UInt64, the first 8 bytes will get read. The same is true for the VB code in Access. What is "dsn" and "km" defined as? What is FindValue defined as? BTW: An Integer in VBA and and Integer in VB.NET don't have the same definition. A VBA Integer is 16-bits (2 bytes), while in VB.NET is 32-bits (4 bytes). Also, in the Access code, you're reading two values, where as in the VB.NET code your reading one. Any reason why? RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
Hi I'm in the process of rewriting a access database type of application, but I run into a problem. This is the Access VB code. dn = FreeFile Open matrix For Binary Access Read As #dn Get #dn, dsn, km Close #dn This the VB.Net code FileNumber = FreeFile() FileOpen(FileNumber, filepath, OpenMode.Binary, OpenAccess.Read, OpenShare.Shared) FileGet(FileNumber, FindValue) To start, I don't none the structure of the file. I'm sending in a search value which should return a result. The VB.Net function isn't returning the same value as the Access VB function. Any ideas why its happening would be appreciated!. Thanks Regardt Africa is a tough country --"Hello daar vir die Afrikaans sprekende"--
:)Hello You Have not given much information what is the type of file you want.ok if you want to get required string from Test.txt file you can give like this dim str as string("strSearch",10) FileNumber = FreeFile() FileOpen(FileNumber, filepath, OpenMode.Binary, OpenAccess.Read, OpenShare.Shared) FileGet(FileNumber, str) Which Give the result start from 0 To byte 10 bytes if you want to search all give the file size you can give random access also.I hope it will help for you Ishak Progarmmer Analyst ITI KSA