|
-
Jun 12th, 2006, 07:36 PM
#1
Thread Starter
New Member
"Specified cast is not valid" error
I am getting the following error: "Specified cast is not valid"
----
Private Sub cmdCalcTotal_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles cmdCalcTotal.Click
Dim ds As DataSet
Try
ds = CType(dgrOrderDetails.DataSource, DataSet)
'Other code here to calculate the order total
Catch ex As Exception
MessageBox.Show(ex.Message, "Cannot set the dataset to the datagrid
datasource")
End Try
End Sub
----
Suggestions are greatly appreciated.
-
Jun 12th, 2006, 07:44 PM
#2
Re: "Specified cast is not valid" error
Have you assigned a DataSet object to the DataSource property of the grid in the first place? If you've assigned a DataTable or a BindingSource or something else then you cannot cast it as type DataSet.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|