-
Casting in Visual Basic
Has anyone figured out how to handle casts in VB?
Given the following line of code in C#:
((TextBox)e.Item.FindControl("Freight")).Text
where e is a DataGridCommandEventArgs.
FindControl returns a generic control instance which must then be cast to a
TextBox to use any TextBox specific properties. This works great in C# but
for the life of me I can't figure it out in VB.
Any ideas?
-
Re: Casting in Visual Basic
Chris,
Look up the CType function.
--Kenny
"Chris Kinsman" <ckinsman@devx.com> wrote:
>Has anyone figured out how to handle casts in VB?
>
>Given the following line of code in C#:
>
>((TextBox)e.Item.FindControl("Freight")).Text
>
>where e is a DataGridCommandEventArgs.
>
>FindControl returns a generic control instance which must then be cast to
a
>TextBox to use any TextBox specific properties. This works great in C#
but
>for the life of me I can't figure it out in VB.
>
>Any ideas?
>
>
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
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks