Visual Basic.NET Programming. Beginner Lesson 7. Arithmetic Operators

แชร์
ฝัง
  • เผยแพร่เมื่อ 11 ก.พ. 2025
  • This is the seventh in a series of computer science video tutorials for beginners, about programming with Visual Basic.NET (VB.NET) in Visual Studio. In this lesson, you will learn how to use arithmetic operators to perform calculations. Specifically, you learn see how to add, subtract, multiply and divide numbers, and how raise one number to the power of another, namely, exponentiation. You will also learn how to perform whole number division with the backslash operator (which works in the same way as the DIV operator in other programming languages and in pseudocode), and how to obtain the remainder after whole number division with the Mod operator. This video also introduces the runtime error, also known as an exception, caused when VB.NET is unable to convert a string into a number. Handling run time errors (exception handling) is covered in detail in a later video.

ความคิดเห็น • 20

  • @azothazwane8474
    @azothazwane8474 2 ปีที่แล้ว +5

    I'm glad I came across your videos. I will recommend my classmates. My lecture has been getting paid for mumbling.

  • @jtlunsford780
    @jtlunsford780 ปีที่แล้ว

    \ / MOD - very helpful explanations of my confused mind. Made notes so I don't forget where to look next time I use one or more of these operators and Data Type to match. Thanks......JT

  • @feraudyh
    @feraudyh 3 ปีที่แล้ว +1

    I was very surprised to see strings converted to integers or double. Is this a compiler option?

  • @kikawet
    @kikawet 4 ปีที่แล้ว +1

    If you input text instead of a number is going to use something like ascii to turn it into a number or is going to raise an exception?

    • @kevinerose
      @kevinerose 3 ปีที่แล้ว +1

      you will need to put in some error checks to make sure the User enters a number. everything entered into a text box is already text. you need to check that the text will convert to a number prior to running the calculation.

  • @Maxxermaximus
    @Maxxermaximus 2 ปีที่แล้ว +1

    With your naming convention you have to go through your complete code if you decided to change the type of the variable like in your example.
    Not very helpful in big projects.

    • @ComputerScienceLessons
      @ComputerScienceLessons  2 ปีที่แล้ว +3

      Personally, I find the benefits outweigh the disadvantages. You can use find and replace when the need arises. If you are the only programmer working on a project, a standard approach is not so important. It's up to you :)KD

  • @weibinren92
    @weibinren92 3 ปีที่แล้ว +1

    Hi, it doesn't work for me, it says Cast not valid from String to the Integer type

  • @Budgie27-v8i
    @Budgie27-v8i ปีที่แล้ว

    10:32

  • @ailomarkdelacruz9524
    @ailomarkdelacruz9524 3 ปีที่แล้ว +3

    ty very helful sir

  • @joachim1022
    @joachim1022 4 ปีที่แล้ว +1

    It doesnt work for me

    • @joachim1022
      @joachim1022 3 ปีที่แล้ว +1

      It says that Text is not a member of txtbox2

    • @ComputerScienceLessons
      @ComputerScienceLessons  3 ปีที่แล้ว +1

      Did you remember to name your textbox on the form? Check that you have spelled the name correctly in your code. When you type txt.. you should see a list of all the textboxes whose names start with txt.

    • @joachim1022
      @joachim1022 3 ปีที่แล้ว +1

      @@ComputerScienceLessons Yes I am sure I even copied exactly what you are doing but it says that txtbox1 was not declared even though its a name. And also it says Text is not a valid member of txtbox2

    • @ComputerScienceLessons
      @ComputerScienceLessons  3 ปีที่แล้ว +1

      I wonder if you have put a control other than a text box on the form. Highlight it and look at the top of the properties window, it should say System.Windows.Forms.TextBox.

    • @joachim1022
      @joachim1022 3 ปีที่แล้ว +1

      @@ComputerScienceLessons Thank you that helped

  • @CapnCook33
    @CapnCook33 2 ปีที่แล้ว +2

    Thank you for this entire series, mate. I’m taking online courses and was tripping over basic stuff for a minute, these helped. I noticed some people mentioning conversions, I used CDbl(txtBox1.Text) and it worked brilliantly.