Solved

what does this code do? Int(txtTEst.Text)

Posted on 2010-09-14
6
355 Views
Last Modified: 2012-05-10
what does this code do? Int(txtTEst.Text).  txtest is a textbox.
0
Comment
Question by:troyvw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 5

Expert Comment

by:Vipul Patel
ID: 33675497
Gives below error
"The name 'Int' does not exist in the current context"
because .net compiler searches method Int(string data).
If it does not exist then gives error else calls implemented method.
0
 
LVL 17

Accepted Solution

by:
Zhaolai earned 500 total points
ID: 33675540
It should be CInt(txtTEst.Text), which converts the text in the textbox to an integer.
0
 

Author Closing Comment

by:troyvw
ID: 33675550
ty
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 17

Expert Comment

by:Zhaolai
ID: 33675608
Remember to check the textbox's text before converting, otherwise it will throw an error.
Like this:

Dim iValue as Integer
If IsNumeric(txtTEst.Text) then
    iValue = CInt(txtTEst.Text)
End If

0
 

Author Comment

by:troyvw
ID: 33675643
What if i wanted it to retain the decimal? for example if i entered 1.3
0
 
LVL 17

Expert Comment

by:Zhaolai
ID: 33675718
Then use CDbl to convert to double, or CSng to convert to single, or CDec to convert to decimal. All of them will retain the decimal.
0

Featured Post

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question