I am trying to read the first xxx characters of a .bmp file into an array so I can get the header data. I have done this in VB6, but am having real time with the new lingo.
Can anyone help?
I am trying to read the first xxx characters of a .bmp file into an array so I can get the header data. I have done this in VB6, but am having real time with the new lingo.
Can anyone help?
I'm not really sure what your asking?
This works in VB.NET 2003. So it should work in 2005. (This is some code I wrote a while back, as an example only)
Dim zzz1 As String
Dim zzz2 As String
zzz1 = Format(e.X, "##0.000")
zzz2 = Format(e.Y, "##0.000")
StatusBarPanel1.Text = (" X: " & zzz1 & " " & "Y: " & zzz2 & " " & "Z: 0.100")
.
Are you looking for a decimal place?
.
Sorry, I must have been too vague with my problem. What I want to do is open a file for random access, and read from it. In VB6 (from what I remember) you would do this:
dim a as string * 1
open filename$ for random len =1
recloc=100
get 1, recloc, a
The above would get the character at position 100 in the file.
With VB Express (which I think is the same as vb.net) you have a differnet open statement and get statement. I have tried them, but I get a record length error.
I was hoping someone had some sample code that worked.
Link:Public Sub GetPixel_Example(e As PaintEventArgs)
' Create a Bitmap object from an image file.
Dim myBitmap As New Bitmap("Grapes.jpg")
' Get the color of a pixel within myBitmap.
Dim pixelColor As Color = myBitmap.GetPixel(50, 50)
' Fill a rectangle with pixelColor.
Dim pixelBrush As New SolidBrush(pixelColor)
e.Graphics.FillRectangle(pixelBrush, 0, 0, 100, 100)
End Sub
http://msdn.microsoft.com/library/en...asp?frame=true
Like the RGB color value? The code above gets the "X=50 & Y=50" location of a .jpg (just change to .bmp)
I think that everything in .net has to be declared as a "New Bitmap" no matter what (GDI+ thing, going on)
.
Thanks for the input, but I should not have mentioned bitmap. My question is how to open and read from a random access file.
I personally can't stand dot net.
Sorry, just couldn't resist.
I found AutoIT does what I want without all the random web searching it takes to find out how to do simple things.
I'm sure it's just a mental limitation of mine, but nowhere could I find a concise description of the overall scheme of things. And I found examples of ten lines of code to do simple functions. After spending weeks playing with the language to write a simple routine I chucked the whole thing and went looking for another language.
From now on, I will stay away from any software with the word "enterprise" anywhere on its website.
End of rant, please disregard.
--97T--
97T-
I agree with you. Maybe I am just not the organized type, but it has gotton so "structured" that it makes it difficult to do simple tasks. I realize that it also allows more felxability, but it makes it too difficult to learn and use for simple tasks.
You may have already figured out your problem, but if it helps I had the same problems with some fills in VB6 and found that it was reading some of the data as on end of file code. I was able to open in binary and loop through till I got the data I needed.
rweatherly- Did you figure out the code for file I/O? I have done this in VS '03, and can pull out some code if you still need it.
rp74-
Thanks -- I found several ways to do it. In the end I decided that I would just stick with doing it in Excel.