Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7818593
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:37:34+00:00 2026-06-02T06:37:34+00:00

in vb, you can use text which is in textbox instead of numerical expressions.

  • 0

in vb, you can use text which is in textbox instead of numerical expressions. I mean, if I write 50 in textbox1 and also I can write like that code:

 Dim result As Double = TextBox1.Text + 0.4

as you see, I didnt convert any type but it works in vb.net

But I want to learn what are disadvantages of this using?

(I am just talking about arithmetic operations)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T06:37:37+00:00Added an answer on June 2, 2026 at 6:37 am

    In VB.NET you will only get away with this if you have OPTION STRICT turned off – otherwise, you’ll generate an error.

    In programmming, you should always try to be as precise as possible with your data types. So you could write your line of code as:

    Dim result as Double = Convert.ToDouble(TextBox1.Text) + 0.4
    

    Alternatively, you could do some error trapping:

    Dim Result as Double
    Try
    Result = Convert.ToDouble(TextBox1.Text) + 0.4
    Catch
    Result = 0
    End Try
    

    There are a lot of other things you can use, include TryParse. You can even use VBA functions like CDbl too.

    If you rely on what is called implicit type conversion, VB.NET will attempt to convert the data type for you. The disadvantage of this approach is that it makes for lazy programming. On this occasion you want VB.NET to be fault-tolerant, but how about when you don’t? If you allow it to correct your errors, you’ll eventually get the situation where you generate bugs because your code isn’t enforcing the correct data type.

    Right – that’s the party line over. Personally, I quite like the way VBA casts data types behind the scenes for me!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Which function can I use to get the content of a plain text file?
I know I can use placeholder=some text here... but how to make it so
We can't use java.text.SimpleDateFormat, so is there any way to create date object from
i am using sql server 2000 can i use full text search on the
In Excel, what formula can I use to repeat text in one cell, for
How can I use strike-through font in objective C??? More specifically in UITableViewCell cell.textLabel.text
I can use the PRINT statement in a stored procedure to debug my code.
We can use solr range query like: http://localhost:8983/solr/select?q=queryStr&fq=x:[10 TO 100] AND y:[20 TO 300]
This is for a multiline textbox on an asp.net site. I can use either
Am trying to write a piece of code which will allows the user to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.