Solved

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

Posted on 2010-09-14
6
308 Views
Last Modified: 2012-05-10
what does this code do? Int(txtTEst.Text).  txtest is a textbox.
0
Comment
Question by:troyvw
  • 3
  • 2
6 Comments
 
LVL 5

Expert Comment

by:Vipul Patel
Comment Utility
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
Comment Utility
It should be CInt(txtTEst.Text), which converts the text in the textbox to an integer.
0
 

Author Closing Comment

by:troyvw
Comment Utility
ty
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 17

Expert Comment

by:Zhaolai
Comment Utility
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
Comment Utility
What if i wanted it to retain the decimal? for example if i entered 1.3
0
 
LVL 17

Expert Comment

by:Zhaolai
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now