Parameter Is Not Valid Exception?
Mar 27, 2009
I get this error from my application, but not in the development environment (VS 2008). I created an installer package and have installed it on two different XP machines with no problem. However, on a Vista system when the application runs code to generate an image I get a "Parameter is not valid" exception. I have no clue what could be causing this given the circumstances. To generate the image I am creating a bitmap with a valid size and simply creating the graphic. Since I can't repoduce the error in VS I don't have a way to troubleshoot this.
View 7 Replies
ADVERTISEMENT
May 14, 2012
Dim data As Byte() = DirectCast(sdr.Item("Image"), Byte())
Dim ms As New System.IO.MemoryStream(CType(sdr.Item("Image"), Byte()))
PictureBox2.Image = Image.FromStream(ms)
After reading many forums and trying the different examples, when I try and load my image from the database I get the "Parameter is not Valid" error.Im using VB 2010, SQL Server 2008 R2, and the data type is Image. I do not have access to the source code that is used to save the picture to the database, just access to tthe data in the db.The code I have included is the code I use to retrieve images from my db which stores the pictures as Image.
View 2 Replies
Aug 17, 2010
STEP1--image data is sending by a vehicle tracking unit.using a socket application i am tracing that data.the data from the vehicle tracking unit is not in a decimal format.image data coming from socket containing lot of special type of characters. so i am converting this image information to hex format using the code below.
Private Function Data_Asc_Hex(ByRef Data As String) As String On Error Resume Next 'first take each charcter using substring. 'then convert character into ascii. 'then convert ascii value into Hex Format Dim sValue As String Dim sHex As String = ""
[code]....
View 14 Replies
Jan 15, 2012
I have a program with multiple forms. I have an upload picture from file form that shows a picture in a picture box when I choose it. However when i navigate away from that form and then return to it a large X appears in the picture box and wont leave. [code]...
View 2 Replies
Dec 25, 2009
I use following codes to display image from SQL Table's image field. But on this line
.Image = Image.FromStream(ms)
it shows this error message
Parameter is not valid.
[Code].....
View 1 Replies
Jun 26, 2011
I have made a program that lets you select an area of a picture and then crop it, I am having problems while drawing the rectangle that shows which area will be cropped, following is my code.
[CODE].............
This is declaration of all the variables that I am using.
[CODE].............
Over here I send the graphics handle of the "canvas" control (which is just a picturebox) to a higher level, so I can use it later.
[CODE].............
Over here I get the starting position for my rectangle
[CODE].............
This part is supposed to draw the rectangle, as I am moving the mouse over the Canvas control, but I get an error where the rectangle is being drawn, I originally thought that the problem might have been with the fact that as soon as I begin moving the mouse, the CropWidth and CropHeight variables are at zero, and that is causing the invalid input error. So I made it that it would not draw the rectangle until it reached a minimum size of 4 x 4 pixels but it still does not fix the error, I debugged to see if there was a problem with the values of the variables, but they all seemed fine, I even tries doing this CanvasGraphics.DrawRectangle(Pens.Red, 20, 20, 20, 20) so as to eliminate the factor of the wrong values, but still the same error.
View 3 Replies
Feb 28, 2010
In this screen I want to let the user decide which elements are on shown on a label. When I hit the update button (BDUpdate_Click; see below), it first checks whether the Barcode sample text is empty. Afterwards I want to invole the refresh of the label preview. The strange thing is that the first time it works fine, but when I alter the sample text and hit the button again, I get the Error "System.ArgumentException was unhandled. Parameter is not valid." The error points to the DrawSting function in the LabelPreview_Paint Sub
Dim BarcodeLabelUpdate As Boolean
Private Sub BDUpdate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BDUpdate.Click
If BDBarcodeSample.Text = "" Then
MsgBox("Please enter a sample text", MsgBoxStyle.Information Or MsgBoxStyle.OkOnly, ProgramTitle)
[code]....
View 2 Replies
Jun 22, 2010
I am trying to run my program to test it. Actually I am trying to run second form to see it that its working properly or not. But it shows me error. First time I got this error message:
"Exception of type 'System.OutOfMemoryException' was thrown"
& second time I got this one
"An error occurred creating the form. See Exception.InnerException for details.
The error is: Parameter is not valid."
By the way my program has 25 forms.
View 2 Replies
Feb 11, 2007
have an OLE Object in my table, that may be jpg, doc, xml file.In case of jpg I'd like to show it (VS2005 Visual basic).I did next (not full code):Dim ms AsNew MemoryStream()Dimreader As OleDbDataReader = md.ExecuteReader(CommandBehavior.SequentialAccess )reader.Read()retval = reader.GetBytes(0, 0, outbyte, 0, bufferSize)ms.Write(outbyte, 0, retval)ms.Seek(0, SeekOrigin.Begin)curImage = Image.FromStream(ms)----> error "Parameter is not valid."I do not see the fault
View 3 Replies
Apr 20, 2010
I am getting a "Parameter is not valid " error when reading a value from an Image property and I don't know why.
Writing to the property works just fine (MyControl.EditImage = PictureBox1.Image) .
Reading from the property causes an error (PictureBox1.Image = MyControl.EditImage )
The Property looks like:
Private mNewImage As Image
Public Property EditImage() As Image
Get
[Code]....
View 4 Replies
May 15, 2009
i'm trying to do a filename compare, sort of fuzzy match.Here's what code i have.First of all i load 2 directory's into 2 listbox's as strings and remove the filepath. Directory1
Code:
TextBox1.Text = FolderBrowserDialog1.SelectedPath
If TextBox1.Text = "" Then
Else
Then when i click the compare button i am trying to pass listbox1 and listbox2 through Distance and return the resulting fuzzy file matches.
Code:
Dim MyObject As New StringSift2
Dim ReturnVal As Single
ReturnVal = MyObject.Distance(ListBox1.SelectedItem, ListBox2.SelectedItem)
[code]....
But i get this error.
Code:
TreeView1.Nodes(lb1).Nodes.Add(ReturnVal.ToString())Specified argument was out of the range of valid values. Parameter name: index
View 3 Replies
Feb 13, 2009
I am trying to write a small app that will read images from an database to an image list. It does the first one, but then after that i get a "Parameter is not valid." exception ... see code below.
vb
Dim cn As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "states.qmw")
Dim cm As New OleDb.OleDbCommand("Select * from tblStates", cn)
Dim rd As OleDb.OleDbDataReader
[code]....
View 1 Replies
Mar 7, 2012
I'm trying to make a Tetris game in VB 2010. I am having some problems with a function I have written that draws new squares and fills them with the colour needed. Here are the details of the error:
System.ArgumentException was unhandled
Message=Parameter is not valid.
Source=System.Drawing
StackTrace:[code].....
The line g.DrawRectangle(Pens.Black, lngX, lngY, 24, 24) is highlighted as the error. 'g' is the graphics of the form and lngX and lngY are the predetermined coordinates of the shape as long variables.I have researched this error but I couldn't understand Microsoft's explanation, and no other threads applied to my case.
View 2 Replies
May 8, 2009
I have a Search Form that can search by a few different fields. The problem field is birthDate. On the form it is a string. In the SQL 2005 db it is a DateTime that can be null.
The code below is sequential as far as declaring the variable on the form and then setting it. Then the call to the BLL and then the call to the DAL.
On this line -->
dgvSearchResults.DataSource =ConnectBLL.BLL.Person.Search(_firstName,_middleName,_lastName,_sSN, (DateTime)_birthDate,_applicationID,_applicationPersonID,_fuzzy);
[Code]....
View 4 Replies
Nov 23, 2009
I am using VB.Net code to print barcode label in Zebra TLP 2844 printer. And the printer is connected to system by USB port. When i execute the code i get an error "Invalid Parameter : Name handle" in the line outFile = New FileStream(_SafeFileHandle, FileAccess.Write) . As this is a USB port So i shared the printer and used the UNC path. But still i get the error. Below is the complete code
[Code]....
View 3 Replies
Dec 10, 2009
I am running the same program on two workstations. One reveals no errors while the other shows a "COM exception error: invalid parameter." The offending line of code is shown below.Is there an explanation for the inconsistency?
.SeriesCollection(iRet).Name = "=""Q" & Str(iRet) & """"
View 1 Replies
May 2, 2012
If the parameter variable is not passed then this code throws an exception of "Conversion from string "" to type 'Date' is not valid."
This is my code.
Public Shared ReadOnly Property Request_projectStartDate() As Date
Get
Dim _value As String = Nothing
[Code] .....
View 2 Replies
Jun 8, 2009
I am using VS 2008 Pro and my ? is, I am trying to add lines to a listbox and keep getting Cross-Thread Operation not Valid exception. The code I am using was downloaded from codeproject. When I run this app, it works fine. I added it to my app and this is where the cross-threading problem occurs.[code]I am trying to convert mp3 files to .wav files. With the line above it works. With it out, the exception is thrown.
View 5 Replies
Jul 28, 2009
I have a windows form that gets data from a scale via the serial port. Since I need the operator to be able to cancel the process I do the get data process on a second thread. The data collection process gets multiple readings from the scale one at a time. The form has a label that needs to be updated with information specific to each reading.
I call the method to get the data from the scale with this code.
Dim ad As New readALine(AddressOf thisScale.readALine)
Dim ac As New AsyncCallback(AddressOf Me.GetDataCallback)
Dim iar As IAsyncResult = ad.BeginInvoke("", ac, ad)
The delegate for the readALine method is defined in the UI code.
Delegate Function readALine(ByVal toSend As String) As String
The GetDataCallback method:
Private Sub GetDataCallback(ByVal ia As IAsyncResult)
.
.
.
lblInstructions.Text = _thisMeasure.dt.Rows(_currRow - 1).Item("cnt") & ":"
lblInstructions.Refresh()
.
.
.
End Sub
I get the exception on the "lblInstructions.Text =" statement. I thought the GetDataCallback method was part of the UI thread so don't understand why I'm getting the exception. I know this could probably be rewritten using a BackgroundWorker and it's appropriate events but for now would like to understand why this isn't working as expected. The application was written originally in VS2003 and just recently upgraded to VS2008.
View 5 Replies
May 30, 2011
The exception message I am receiving is this... "Year, Month, and Day parameters describe an un-representable DateTime."
Now I've traced my values being passed and everything is correct. Values loops through 1 to 12 but still I continue to receive an exception. Only way I can avoid this is by throwing a Try, Catch statement around where I'm passing over the value.
Here's my code..
001 Dim Calendar(11) As AppointmentBookControl.AppointmentBookControlMonthlyOverviewCalendarControl
002
[Code]....
Line '011 .Month = i+1' is where the problem is located. The values for (i+1) maintain within the bounds of 1 through 12..
View 5 Replies
May 20, 2010
I am having problems with the code below. I have copied and pasted the code from a program that I wrote to test and see if the code does work. In that program it does. But when I use the same code in another program I get the following error message. invalidcast exception was unhandled conversion from string to type integer is not valid.
[Code]....
View 16 Replies
Dec 31, 2009
I've written the following code to draw a trajectory of points in my program:
Private intNumOfPoints As Integer = 0
Private PtTrajectory(intNumOfPoints) As Point[code]....
*Pos.X and Pos.Y are calculated in the other parts of my program. But, it has a run-time error: "Parameter is not valid".
View 7 Replies
Jun 9, 2011
Public Sub imageload(ByVal index As Integer, ByRef imagedescription() As String)
Dim da As New OleDbDataAdapter("Select Foto From Images where Photoindex = " & index & ";", Form1.baglanti)
Dim dt As New DataTable
Dim ms As New MemoryStream
[code]....
i was take "Parameter is not valid." error pff where is my mistake?
View 3 Replies
Mar 5, 2009
I've got the web browser with tabs in all working fine, but there's one bug, i can add tabs, delete em, etc.. but when i delete a tab then go to create a new tab, it gives me the error: InvalidArgument=Value of '6' is not valid for 'index'. Parameter name: index '6' is the number of tabs i had open.Here's the bit of code i use to create the tabs with the browser in it:
vbcode
Dim browse As New WebBrowser
browse.Name = "b1"
browse.Dock = DockStyle.Fill
[code]....
View 2 Replies
Jul 26, 2009
When the selected index changes I for a second time this code errors.
vb.net
lvReports.SelectedItems.Item(0).SubItems.Item(2).Text
with this error message
InvalidArgument=Value of '0' is not valid for 'index'. Parameter name: index
Why is this?It worked for the listviews.click event perfectly.
View 2 Replies
Oct 10, 2010
I have been trying to learn vb.Net for about a year now, but with other work getting in the way, my progress forward is moving, but not as fast as I would like. So I am hung up on this issue which seems like it should be a no-brainer but it still does not make sense, and I can't find any clarification on it.
With the
With MyPen
.Color = Color.FromArgb(LineColorVALs(7, SearchIndex1, SearchIndex2))
.Width = LineWeights(7, SearchIndex1, SearchIndex2)
End With
The array "LineWeights()" is declared as Integer and the values of the indexes are correct. This leads to an integer value of "1" coming out of the array and into MyPen.Width.
The ".Color" line executes OK, but I get the error, "Parameter is not valid." at the ".Width" line. I have tried declaring LineWeights as Short, too, but same problem.
View 13 Replies
Nov 14, 2009
I am getting this exception: Cross-thread operation not valid: Control 'TextBoxOutput' accessed from a thread other than the thread it was created on. in a VB 2008 Windows Forms application that I havent specifically made multi-threaded. I have create a sub called Out() like this:
Private Sub Out(ByVal inString As String)
Me.TextBoxOutput.Text += (Me.TextBoxOutput.Text & inString & vbNewLine)
Me.TextBoxOutput.SelectionStart = Me.TextBoxOutput.Text.Length
Me.TextBoxOutput.ScrollToCaret()
End Sub
and I call it from various events to log messages I am getting from my pbx, which I use a third party open source dll to access. The interesting thing to me is that if I run the deployed application (ie, not in the VS IDE) I do not get any exceptions, it's only from within the IDE.if I add the line: Control.CheckForIllegalCrossThreadCalls = False to the form's constructor, the exceptions stop, but a) this seems like a hacky way to get around the issue and b) the application seems to hang sometimes when I have it set this way.
View 2 Replies
Apr 28, 2010
VB 2003 Combobox collection from -3 to +3 The goal of the message is to warn the user that the systems only covers +- 3 timezones, if he types in for example +4 or -4, he gets the message (by the way: how to protect the system if he types for instance a character?)
When I run the application: 'Unhandled exception: Cast from string "click" to type 'integer' is not valid
Private Sub ComboBox1_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.TextChanged
[Code]...
View 6 Replies
Apr 28, 2010
Combobox collection from -3 to +3 The goal of the message is to warn the user that the systems only covers +- 3 timezones, if he types in for example +4 or -4, he gets the message (by the way: how to protect the system if he types for instance a character?)
When I run the application: 'Unhandled exception: Cast from string "click" to type 'integer' is not valid
Private
Sub ComboBox1_TextChanged(ByVal
sender As
Object,
ByVal e
As System.EventArgs)
[Code]...
View 10 Replies
Feb 17, 2011
am getting the above exception while swaping Items in the list(lstRoutePriority).PFB my code
if (lstRoutePriority.SelectedIndex > 0)
{
//Swap the two items
[Code].....
View 2 Replies