|
-
Apr 20th, 2004, 08:55 AM
#1
Thread Starter
Hyperactive Member
form.showDialog()
I have three forms: A, B and C
There is a button on A to load B, and a button on B to load C, which has a datagrid with checkbox column.
I use showDialog() to load the forms.
When I click the checkbox on C's datagrid, i get error on A's button click event "An unhandled exception of type 'System.InvalidCastException' occurred in system.windows.forms.dll
Additional information: Specified cast is not valid."
Any idea? Thanks.
-
Apr 20th, 2004, 09:18 AM
#2
Hyperactive Member
Yes! Vb.NET has a particular and misterious way to show its errors.
The error is probably in the code of Form C, as you can imagine, but when forms are showed as Modal (like ShowDialog), VB.NET make green the code line in which the form is showed. I don't know why, but I've verified this. You have to follow your application step by step and you will catch the mistake.
Good job!
Live long and prosper (Mr. Spock)
-
Apr 20th, 2004, 09:30 AM
#3
Thread Starter
Hyperactive Member
Thanks for your reply.
Yes, i think the error is about Form C. in particularly, the bool column in that datagrid. The first time i click the checkbox, it is ok, but if i check again,
Here is the code for that boolean column:
VB Code:
Dim activeCol As DataGridBoolColumn = New DataGridBoolColumn()
activeCol.MappingName = "Active"
activeCol.HeaderText = "Active"
activeCol.AllowNull = False
activeCol.FalseValue = CShort(0)
activeCol.ReadOnly = False
activeCol.TrueValue = CShort(1)
activeCol.Width = 100
activeCol.Alignment = HorizontalAlignment.Center
dgts.GridColumnStyles.Add(activeCol)
-
Apr 20th, 2004, 09:47 AM
#4
Hyperactive Member
I must stop here, because I've never used a datagrid! Anyway the kind of error says to us that your application is trying to put a certain type of data in a place that is made for a different one, or something like this!
Good job
Live long and prosper (Mr. Spock)
-
Apr 20th, 2004, 09:57 AM
#5
Thread Starter
Hyperactive Member
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
|