Тёмный

Visual Basic Tutorial - 44 - ByVal 

thenewboston
Подписаться 2,7 млн
Просмотров 79 тыс.
50% 1

Source Code: github.com/the...
Core Deployment Guide (AWS): docs.google.co...

Опубликовано:

 

20 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 37   
@alphaahtube
@alphaahtube 12 лет назад
That depends on what the function does. A function could need a string to output, or to manipulate, but it would return an integer. An example is a function that gets the length of a string, you would pass a string as an argument, but it would return an integer.
@floreloriz4667
@floreloriz4667 8 лет назад
I didn't know so simple calculator can be made. TY
@xXBR4D3NXx
@xXBR4D3NXx 11 лет назад
ByVal - " Specifies that an argument is passed in such a way that the called procedure or property cannot change the value of a variable underlying the argument in the calling code." - MSDN
@alphaahtube
@alphaahtube 12 лет назад
He means that, you can pass arguments of any type even if it's different than the function's type. Function's type is the type of data that it returns, argument's type is the type of argument that is passed to the function.
@rajamohdafiq480
@rajamohdafiq480 11 лет назад
this is tutorial so that someone like me can learn the basic thing that maybe can be use in big thing.
@OriginalTrousers
@OriginalTrousers 11 лет назад
Why use ByVal at all? Why not just do private function subtract(num1 as double, num2 as double) as double return num1 - num2 end function
@brandondupuis8243
@brandondupuis8243 9 лет назад
Good tutorial man! Nice job :)
@2pimpinout
@2pimpinout 12 лет назад
@techstuffs27 double click on "My Project" on the side, and a Windows will open with an Application tab selected. You will find the icon selection.
@vamsikrishnanmysore2788
@vamsikrishnanmysore2788 9 лет назад
great work....................bro
@peterkandiwo7806
@peterkandiwo7806 10 лет назад
it is pretty good
@Cliffardo
@Cliffardo 6 лет назад
Stranger error, but its an annoying one I did this perfectly fine and I had no errors it works. I re open the project the code still works however some of it is underlined in red? EDIT: Okay this is happening on like everything now, even on things like Console.ReadLine it keeps underlining them in red when its fine and it is working OK I don't know what has happened but it is extremely annoying. I need to do screenshots for evidence but I can't with this there and there is nothing wrong with the code. The thing the error keeps saying is "Option Strict On disallows implicit conversions from String to Integer" This error has never come up for me before until the past hour or so I don't know if I have turned on a setting somewhere or what
@rwbangsil
@rwbangsil 8 лет назад
it is a bad example of byval, coz when i tried to change it to byref, it gave the same result.
@etherealvox2010
@etherealvox2010 8 лет назад
assume variable "input"=10 assume a function named "newFunction" that increments the argument 1) using myVar i.e. newFunction(myVar x as integer) bla bla --> x +=1 newFunction(input) the result will be 11 console.writeline(input) the result will pe 10 2) using myRef i.e. newFunction(myRef x as integer) bla bla --> x +=1 newFunction(input) the result will be 11 console.writeline(input) the result will pe 11
@DaCurse0
@DaCurse0 8 лет назад
ty somuch ur op
@TheRoxas13th
@TheRoxas13th 11 лет назад
Yeah, it work exactly the same without the ByVal. Someone explain this to me =="
@kuroodo_
@kuroodo_ 11 лет назад
MessageBox.Show("It's also a good idea to try doing things on your own without the tutorials. I've learned alot as well without watching the tutorials", "My Comment",MessageBoxButtons.OK)
@ThatsoCliche
@ThatsoCliche 11 лет назад
Private Function Divide(ByVal num1 As Double, ByVal num2 As Double) Return num1 / num2 End Function Private Function Multiply(ByVal num1 As Double, ByVal num2 As Double) Return num1 * num2 End Function Private Function Subtract(ByVal num1 As Double, ByVal num2 As Double) Return num1 - num2 End Function End Class
@MrEpicSpace
@MrEpicSpace 9 лет назад
ByVal isn't even needed in VB 2013, and I have done outcome comparisons and nothing changes. It's useless, and Microsoft kept ByVal there. It must change something that we know nothing about. Or maybe it really doesn't do anything Edit:It's official: ByVal is rendered useless in Visual Basic on Visual Studio 2013
@SCIFIDW
@SCIFIDW 9 лет назад
***** Sorry if this is a stupid question but I'm very new to programming. So you mean we can remove ByVal and it would work without replacing it with something?
@MrEpicSpace
@MrEpicSpace 9 лет назад
SCIFIDW Yes. ByVal is useless in the new VB
@xiaozhang4066
@xiaozhang4066 11 лет назад
I still don't understand what ByVal does. Does is dim the variables outside the function? Cause you didn't dim num1 and num2 in sub but function. Also, the perimeter (TextBox1.text, TextBox2.text) confuses me allot.
@longsophy1130
@longsophy1130 8 лет назад
Could anybody tell me if textbox.text return number value or string? if it return a string, why we can pass this string to the arguments of double datatype in subtractNumbers function? sorry my English isn't good. i'm learning it.
@elmik1351
@elmik1351 2 года назад
Sorry for the 5 year late reply, Textbox.text returns any value depending on the variable you want to display in the textbox. So, if you want to display a string in the textbox, thats fine. Works with an Integer as well as doubles.
@pb695
@pb695 10 лет назад
what if i want characters e.g "a,g,h," instead of numbers as the variable?
@MrEpicSpace
@MrEpicSpace 9 лет назад
instead change it is "As String"
@alphaahtube
@alphaahtube 12 лет назад
C++.
@sbasalan
@sbasalan 11 лет назад
like a couple numbers of your video style.. You made the some showing same way to show..
@ThatsoCliche
@ThatsoCliche 11 лет назад
SIMPLE CALCULATOR ENJOY :D
@djuroue1
@djuroue1 13 лет назад
5th yes yes
@ThatsoCliche
@ThatsoCliche 11 лет назад
Public Class Form1 Private Sub BtnSubtract_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSubtract.Click Dim Answer As Double = Subtract(TextBox1.Text, TextBox2.Text) MessageBox.Show(Answer) End Sub
@bomer890
@bomer890 13 лет назад
10th to caomment... "where beginner javascript tutorial?"
@Quan-mh3lc
@Quan-mh3lc 10 лет назад
hehe
@Raw2v07
@Raw2v07 12 лет назад
@fillecool2 Think its My.computer.audio.Xxxxxxxxxx Cant remember the rest soz intellisense will know though
@mattwhitfield314
@mattwhitfield314 13 лет назад
8th comment! Lol
Далее
Visual Basic Tutorial - 45 - ByRef
4:55
Просмотров 56 тыс.
Introduction to Visual Basic Arrays
11:54
Просмотров 21 тыс.
LIFEHACK😳 Rate our backpacks 1-10 😜🔥🎒
00:13
А вам, слабо?
00:22
Просмотров 51 тыс.
Visual Basic Tutorial - 43 - Functions
5:27
Просмотров 163 тыс.
Visual Basic Tutorial - 49 - Events
6:30
Просмотров 56 тыс.
Learn JSON in 10 Minutes
12:00
Просмотров 3,2 млн
How 3 Phase Power works: why 3 phases?
14:41
Просмотров 1 млн
Calculus at a Fifth Grade Level
19:06
Просмотров 8 млн
Coding Was HARD Until I Learned These 5 Things...
8:34
Think Fast, Talk Smart: Communication Techniques
58:20
LIFEHACK😳 Rate our backpacks 1-10 😜🔥🎒
00:13