|
-
May 20th, 2004, 02:21 PM
#1
Thread Starter
Frenzied Member
late binding [RESOLVED]
i have a sub that takes a tabPage as an argument. a tab page is cleared when a button on that page is clicked.
with option strict on, I get a cast error even when the sub has NO code in it. what is going on?
Last edited by Andy; Aug 13th, 2004 at 12:05 PM.
-
May 20th, 2004, 09:40 PM
#2
Post your code and what is the error exactly.
-
May 21st, 2004, 05:11 PM
#3
Thread Starter
Frenzied Member
VB Code:
Private Sub tab_25_btnClearAll_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles tab_25_btnClearAll.Click
'Dim ctrl As TabControl = CType(sender, TabControl)
'Client.ClearTabControl(ctrl)
'tab_25_optNo.Checked = True
End Sub
the error is :"Specified cast is not allowed.
here's what's going on: option strict is on. when I hit F5, I get build errors and I chooses 'yes' to continue (I think that's the problem) then, when I click this button, I get the error. Notice that the code inside the routine is commented out. the error highlights the sub declaration section.
-
May 21st, 2004, 05:12 PM
#4
yay gay
NEVER continue with build errors. It's just not worth..
\m/  \m/
-
May 21st, 2004, 05:32 PM
#5
Sleep mode
Try DirectCast function instead of Ctype function .
-
May 21st, 2004, 09:38 PM
#6
Originally posted by Pirate
Try DirectCast function instead of Ctype function .
Why would that matter? The only difference between the two is CType can work with value and reference types whereas DirectCast only works with reference types.
What type of control is tab_25_btnClearAll? Is it a button? If so then sender is probably the button and not a tabcontrol hence the error. Although the designer should be picking that up at compile time.
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
|