DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Chris Kinsman Guest

    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?



  2. #2
    Kenny Acock Guest

    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?
    >
    >



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


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


Sponsored Links