1 / 5

Ch 3 Type Conversion

Ch 3 Type Conversion . Yonglei Tao. Method TryParse (). Convert a string to a numeric data type Dim decSales As Decimal Decimal.TryParse ( txtSales.Text , decSales ) Dim intNum As Integer Integer.TryParse ( txtNum.Text , intNum ). Class Convert.

rio
Download Presentation

Ch 3 Type Conversion

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Ch 3 Type Conversion Yonglei Tao

  2. Method TryParse() • Convert a string to a numeric data type Dim decSales As Decimal Decimal.TryParse ( txtSales.Text, decSales ) Dim intNum As Integer Integer.TryParse( txtNum.Text, intNum )

  3. Class Convert • Provides methods to convert a value from one data type to another decTax = Convert.ToDecimal ( dblRate ) * decTotal lblAvg.Text = Convert.ToString ( intAvgScore )

  4. Method ToString() • Available to each variable of a numeric type lbl.Commission.Text = intCommission.ToString ( “C2” ) lblRate.Text = dblRate.ToString (“P0”)

  5. Option Explicit/Strict

More Related