473,407 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

System.ArgumentException was unhandled Message: Parameter is not valid.

Hi everyone i'm using vb 2008 for this project and i'm still not so familiar with it so please help me...

I'm trying to display image from MS Access database to another form picturebox but its not working.

this is the error i always encounter -> (System.ArgumentException was unhandled

Message: Parameter is not valid.)

Expand|Select|Wrap|Line Numbers
  1. Dim cn As New OleDb.OleDbConnection
  2. cn.ConnectionString = ""
  3. cn.Open()
  4. Dim arrImage() As Byte
  5. Dim myMS As New IO.MemoryStream
  6. Dim da As New OleDb.OleDbDataAdapter("SELECT * FROM tblRecords " & _
  7. " WHERE ID=" & Me.txtID.Text, cn)
  8. Dim dt As New DataTable
  9. da.Fill(dt)
  10. If dt.Rows.Count > 0 Then
  11. Details.lblId.Text = dt.Rows(0).Item("ID") & ""
  12. Details.txtSpecies.Text = dt.Rows(0).Item("Species") & ""
  13. Details.txtMutation.Text = dt.Rows(0).Item("Mutation") & ""
  14. If Not IsDBNull(dt.Rows(0).Item("photo")) Then
  15. arrImage = dt.Rows(0).Item("photo")
  16. For Each ar As Byte In arrImage
  17. myMS.WriteByte(ar)
  18. Next
  19. Details.picPhoto.Image = System.Drawing.Image.FromStream(myMS) <--- here where i'm having error
  20. End If
  21. Else
  22. MsgBox("Record not found!")
  23. End If
  24. Details.Show()
  25. cn.Close()
  26. End Sub
thank you in advance :)
Sep 23 '12 #1
0 1990

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Victor Crudu | last post by:
Hi, could somebody help me to solve the follwing problem ? I get the following exception when i set as the DataSource of a DataGrid a DataTable. This situation can be only if I change...
0
by: Martin | last post by:
I have Panel embedded in a Form. The panel has a PaintEventHandler to catch PaintEvents. When a PaintEvent occurs a new Thread which moves a Ellipse should be created. The Code: private void...
0
by: CroDude | last post by:
Hi all! I have problems when writting bitmap to a byte array and after reading it back form byte to Bitmap object. What I do is this: First I throw Bitmap to a memory-stream and then I write it...
2
by: Simon Harris | last post by:
I have created a web service, which when I call in my browser presents the text form etc. When I click the button, I get this error: System.ArgumentException: Cannot convert to System.Int32....
3
by: Richard de Beer | last post by:
Hi, I've got some old code(VB6) which has been upgraded to VB.net. In the old code, the undocumented function "VarPtr" is used. But in VB.net, this function is no longer supported. I've searched...
18
by: Atara | last post by:
In my apllication I use the following code: '-- My Code: Public Shared Function strDate2Date(ByVal strDate As String) As System.DateTime Dim isOk As Boolean = False If (strDate Is Nothing)...
2
by: Lambuz | last post by:
Hello everyone, I have an applciation that uses remoting. When the application is run via a local copy it works. When it is run via an HTTP address RemotingConfiguration.Configure fails....
3
by: ohmmega | last post by:
since its common knowledge that it's not possible to hide a tabcontrol tab, i made a collection for removed pages including their tabcontrols. removing works pretty fine, but whenever i try to add...
1
by: Nikky85 | last post by:
Hi, I am trying to configure one http module(a vb module) on MOSS site. In this module I have entry like below: Dim roles As String() = Nothing Dim webIdentity As New...
0
by: pd singh | last post by:
I want to pass a parameter 'str' in my sql query.on the basis of this parameter, the gridview in the next table will be refined. the following exception was generated-: System.ArgumentException...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.