I have a panel with some controls in it (several textboxes, a slider, 2 buttons, and a small groupbox).. When I click a button, I want all of the textboxes within the panel to be readonly... So I have this code: [code] When I run it though, I get the following error:Unable to cast object of type 'System.Windows.Forms.Button' to type 'System.Windows.Forms.TextBox'.If I remove a button, it moves on to give me the same error but for a label..
When testing the followng code from Mastering VB2010, I get an Unable to cast object of type 'System.String' to type 'System.IFormatProvider' exception.In the Button1_Click event code Dim strmOut As New System.IO.StringWriter(SaveFileDialog1.FileName)the 'SaveFileDialog1. FileName' is underlined with a green squiggle and displays the following tool tip:Runtime errors might occur when converting 'String' to'System. Iformat Provider'.This is apparrently the problem but what does it mean and how do I fix it to get the code to work? 'Code being tested that runs the exception:Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click.[code]
I have a form contain 10 checkbox. how to count total checkboxes that has been checked? i search over the internet but not found any solution. please help me. i found a code, but when i apply it on my project it says "Unable to cast object of type System.Windows.Forms.MenuStrip' to type Component Factory. Krypton.Toolkit.KryptonCheckBox'".i think i have problems with Me.Controls(on the code)[code]
I am getting a really bizarre error and it makes no sense at all.Basically I have a user entity which has a Password property. This property is of Type Binary, the server data type being Binary(512).I am reading this value in and converting it to a byte array. However whenever I run my code I am getting a completely unrelated error of Unable to cast object of type 'System.Guid' to type 'System.String'.This strikes me as very odd since I am not using a property or variable of type string or GUID anywhere in this procedure where it falls over.
The code is below:
Public Shared Function ValidateUser(ByVal username As String, ByVal password As String) As UserValidationMessage Using db As New EntityMapDataContext Dim u = From user In db.Users Where user.Username = username
I have a bit of trouble right here, I am trying to get the data from the site and input them in the listview. Well, when my main app start to load through on debug, then it start to display a warning. The warning is: Unable to cast object of type 'System.String' to type 'System.IFormatProvider'.
I'm getting a sporadic 'Unable to cast object of type 'System.Int32' to type 'System.String' Exceptions at .SingleorDefault() in the below code. It works 9/10 times but randomly it throws an exception. I made sure that SettingID that i'm passing has no Null Values and the data in the table always exists for the settingID, and i'm always passing SettingID as Integer.
Code: Dim sql2 As String = " SELECT * FROM Etiqa_Image_Details where TransmissionID='" & Request("id") & "' " With objDB.OpenDataReader(sql2) While .Read() If .Item("ImageType") = "Invoice" Then imgInv.ImageUrl =
However,i get this error while retrieving the image path(Varchar in sql server 2000) and display the image on the web.
Unable to cast object of type 'System.String' to type 'System.Byte'.
Actually in my database, i am just storing the image path where the image store...And now when I browsing the web, it should get the image path out and find the image through the image path and then display on the web....
I am getting the following erro message: "Unable to cast object of type 'System.String' to type 'System.Predicate`1[System.String]'." on the line of code: If Not StrgFrag.Exists(wrd) Then I was expecting a True/False response and assumed it would work given that wrd is a String variables and StrgFrag in a List(of String). Do I need to reference the wrd variable differently? Dim StrgFrag As New List(Of String)
I'm new to VB 2005, the code below is actualy coded from VB 6 and just converted it to VB 2005. I'm having trouble with line that's on bold letters.In VB 6 this works just ok. By the way the error message is "Unable to cast object of type 'System.String' to type 'ADODB.Connection'." [code]
I have an InvalidCastException Error in my program. The program is that i try to insert an employee record into a database table after getting the details from a form. I've used Money data type is SQL Server for salary and SqlTypes.SqlDecimal data type in employee template class. i've used a stored procedure to pass the values and i add the basic value by passing a parameter by the method
Dim prm8 As SqlParameter = com.Parameters.Add("@basic", SqlDbType.Money) prm8.Direction = ParameterDirection.Input prm8.Value = emp.Bsc
I've used the money datatype itself even in the stored procedure variable.I get the following error.
failed to convert parameter value from sql decimal to decimal Even if i use prm8.Value = Convert.ToDecimal(emp.Bsc)
I get an error Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible'.
I'm creating a student evaluation form in a repeater that should submit the evaluation responses and update the SQL database, but I keep getting the error mentioned in the title. I'm coding in ASP.Net using VB.
Code: Dim dom As New DOMDocument30 dom.async = False dom.Load(serverAddress & "/App/filelist.jsp?type=content") For i = 0 To dom.childNodes.item(1).childNodes.length - 1 downloadfile(dom.childNodes.item(i), mcount, currentpath) Next
The above code is activated upon clicking of a button. i have the server address declared. and using the domdoc to load the jsp file to generate the xml data. and using for loop, i call the download file function which accepts the following parameters
Code:Public Sub downloadfile(ByVal domdoc As Xml.XmlNode, ByVal totalcount As Integer, ByVal currentpath As String)
The totalcount and currentpath work fine, but when i pass in the dom.childNodes.item(i) , error pops up.
--------------------error message------------------------------------------Unable to cast COM object of type 'System.__ComObject' to class type 'System.Xml.XmlNode'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.-------------------------------------------------------------------------------