Error in CType
Hi,
I want to access a control in a datalist and I type:
Dim txtbox as Textbox = CType(datalist.item.findcontrol("Name"), Textbox)
However, it shows me an error of this statement:
Value of type "System.Web.UI.Control" cannot be converted to "System.Windows.Forms"
Could anyone help me? I search almost the whole internet and it seems that no one has come across this problem!!!
[422 byte] By [
THL] at [2007-11-11 7:05:35]

# 1 Re: Error in CType
If you have the line "Imports System.Windows.Forms" at the top of your code file, delete it. You may also want to look at your project's References in the Solution Explorer, and remove the reference to System.Windows.Forms, if present.
# 3 Re: Error in CType
I'm not sure. It probably depends upon the order in which you add References/Imports statements.
P.S. -- I can't think of a good reason why one would need both System.Windows.Forms and System.Web.UI in the same project, can you?