William Rosener: Hello this is Dr. Baron roesner welcome to is slash CS 3023 object based visual programming.
William Rosener: Let's start by taking a look at the first assignment, you're going to learn how to create and then I'll walk you through it step by step. So we're going to have a little text here simple calculator. Your name will allow the user to enter in some values.
William Rosener: User can then hit a plus to add a muck the minus to subtract them. It can multiply and divide and also clear
William Rosener: Okay, well, now that we know what we're gonna do. Let's go ahead and get started here. So the very first step. I'm gonna do is I'm going to press on the Start icon and I'm gonna come right up here and choose Word Microsoft Office Word.
William Rosener: Okay, I'm just going to go ahead and choose a blank document here and let's get started here. So at the very top, it says simple
William Rosener: Calculator.
William Rosener: And then go ahead and put your name.
William Rosener: And I'm gonna go ahead and increase the font size here a little bit.
William Rosener: And then if you want to kind of minimize the space between those I come right up here to a line spacing and I'll change this to zero and single impressive.
William Rosener: Okay, now take a look. I take a look here at the original I'm going to create a table to kind of help organize this I'm going to have 123 columns in 123 rows.
William Rosener: Okay, someone come right up here to Insert Table and I'm going to go a three by three.
William Rosener: The very first cell number and type in first number
William Rosener: And I'll type in second number
William Rosener: And I'll type in answer.
William Rosener: Take a look over here at the right. Notice I'm going to take all of these, these three rows and merge them. So I'm just going to simply highlight these three songs, right click and hit merge cells. So that's kind of acts more like one seller.
William Rosener: Okay, next step we need to do is begin working with Visual Basic and let me go ahead and pretend. I've got the Developer tab as well. So I'm going to go ahead and turn it off.
William Rosener: Then I'll turn it right back on so you can kind of watch me as I turn it on, not there. Okay, so did when you first open up Microsoft or there's a really good chance
William Rosener: That your Developer tab is not visible to get that visible, you're going to press right here on file. You're gonna come down to options.
William Rosener: You're going to choose customized ribbon and you're going to choose the Developer tab and press OK, and so now we've got the Developer tab visible.
William Rosener: And what I want to do is create a couple input boxes right here where the user can enter data to do that. I'm impressed with first of all position my cursor where I want to insert
William Rosener: The text box there. Remember, choose developer when we can right over here under active x under these here's legacy active x which is right here. The AB with the vertical bar text box active X control.
William Rosener: Okay, now I'm going to go ahead and right click on this, let me go to properties and I'm gonna do a couple things right. One is, I'm going to give this a name txt number one, so I can refer to it in Visual Basic
William Rosener: I'm also going to go ahead and increase the font size.
William Rosener: You know, just go with 18 here.
William Rosener: And then I'm going to go ahead and and kind of stretch this out a little bit there and make that a little bigger.
William Rosener: Okay, once I've got one done I can repeat that, or I can highlight this one, which I'm gonna do, I'm just gonna hit that control see to copy and Control V to paste and now all I need to do is come right up here and call this one txt to
William Rosener: ME SICK stretches out just a little bit here. A little room around those
William Rosener: Okay, so these were text boxes where the user can enter in data. I'm not going to come right back up here and I'm going to position my cursor right here. And I'm going to go ahead, insert
William Rosener: Label active X control.
William Rosener: Okay, we're going to go ahead and call this one LPL answer.
William Rosener: And what you're going to find is kind of the Convention out there is. If it's a text box that starts with txt if it's a way of all, it starts with a be out
William Rosener: At this point, I'm going to go ahead and delete label one so it does not appear there and I probably should have resize this little bit there me resize this so kind of matches that
William Rosener: Then, awesome. I'm gonna go ahead and change the font size solve them are a little bit larger their IT team.
William Rosener: Okay, so we're going to text boxes a label. I'm now ready to insert some commandments, and that's going to be
William Rosener: All five of these the plus, minus, multiply, divide in the clay are going to be commandments something behind press right up here again right here. There's the command, but
William Rosener: We've had press on that where it says a command button one I'm going to go ahead and delete that and put a plus sign.
William Rosener: And let me go ahead and increase the font size, you may want to go the large, I'm just going to go with 18 I noticed, though. The next step was 23 so well let me just stick it in there.
William Rosener: Okay. And if you want kind of increase the width and height of that once you've got one. You could copy it and paste it.
William Rosener: And if you wanted to get it the Enter key and paste them on new lines like I did on my hand out or you could leave them all kind of is a little group there.
William Rosener: Okay behind hoops wall must appear before doing this. This first one I'm come back here. I'm going to call this one see amp D. It's going to be for command and
William Rosener: I'm not going to highlight the next one. And again, you can maybe stack Cooper to claim.
William Rosener: I'm gonna go ahead and change this one minus
William Rosener: Recall this one see him D.
William Rosener: Subtract
William Rosener: And I'll go ahead and
William Rosener: Close that their next one is going to be will begin to the VP here in a second. The multiply
William Rosener: The call that would see MD multiplied
William Rosener: Oops.
William Rosener: And finally, the last one here.
William Rosener: Which is that to divine
William Rosener: Okay, I'm gonna tell you what, let me go ahead and create one more. Let me copy that one.
William Rosener: Paste. I'm gonna highlight this last one I'm gonna change the caption to say clear
William Rosener: And appear and change this to say clear
William Rosener: And let me go ahead and increase the width element. So all the text is visible there.
William Rosener: Okay, so good. So my text boxes. I've got a label which you really can't even see there, and I've got
William Rosener: These here for command buttons for multiplier add, subtract, multiply, divide and a clear button. Okay, let's go ahead and start off with
William Rosener: The plus button. So I'm gonna go ahead and double click on it. Pretty soon we're going to be turning the design mode off right now it is on. So I double click on a command button, it goes to the VM.
William Rosener: And that was because I had accidentally clicked that such a let me go ahead and
William Rosener: click Delete that if you had not accidentally clicked on that we're going to double click here, it's just going to say CMT ad
William Rosener: And if it's clicked. This code is going to get executed. So we're going to start a sub routine and the sub routine in here was the name. I called it, C and D add if I click on it, what am I going to do, I want to say it will be only answer is equal to txt number one plus txt to
William Rosener: In order to save would need to do a little work with that. So if I now I'm going to go ahead and press on the Design Mode effect execute in it.
William Rosener: exit exit exit out of the design mode. So now let me go and put a value in here I put in 12 into if I hit the plus side.
William Rosener: Notice what it has done is a string concatenation is taking the string 12 and the strength to and added this up. That's not what we want to do we want to add up the values in those text boxes.
William Rosener: Okay, so I need to go back to PB ends. I'm going to press on the design mode we double click on the plus sign and when I need to do is put a bow.
William Rosener: Before each one of these. So within parentheses.
William Rosener: I've got bound in parentheses that text box us not to take the value in texting texting them one plus devalued texting them to and store it and I'll be able to answer.
William Rosener: So let's go ahead and check that out. I'm going to hit the plus button. And sure enough, that is 14 and tell you will not let me just go ahead and show you one more time here on the properties
William Rosener: This first one was called, oops, let me come here.
William Rosener: txt number one.
William Rosener: txt number two and LB, LB answering, make sure you don't have any spaces in there, etc. If you kind of match yours identical to mine, it should work there.
William Rosener: So what we're doing is we're saying LBO answer is equal to the value and txt and I'm on plus txt non two. Okay, let's go ahead and do the the subtract
William Rosener: Here I'm just going to grab this kid right up here copy and
William Rosener: Paste it and change the plus two minus close that out.
William Rosener: Exit the design mode to subtraction 12 minus two is 10
William Rosener: will repeat this for the multiply
William Rosener: Interconnect probably show you there is the multiplication symbol is the shift of the eight
William Rosener: We're going to close this out.
William Rosener: And we need to do the
William Rosener: Division here.
William Rosener: Okay and exit the design mode and it's clear. And there's a lot of air check and you can do here. For example, if I was to just go ahead and get some time here.
William Rosener: Five it entered 12 and this one was blank and I had enter that you're going to get an error message division by zero. So let's go ahead and fix that.
William Rosener: At least on this one here. I'm going to go ahead and take a look at the information in that text box and I'm gonna take a look at a txt. Well, first of all, and do a trend.
William Rosener: txt them to is equal to blank then are and have a message box up here.
William Rosener: Please enter a value for second number
William Rosener: And we'll be getting into the statement later on. But let me just go ahead and finish this up here.
William Rosener: Okay.
William Rosener: So what's going to happen is I'm going to trim. I'm gonna remove any white spaces tabs.
William Rosener: And if what is left is the NOL character, in effect, there's nothing left. Then I'm having a message boxes message box appear here is information that's going to appear there, please enter value per second number else I'm actually going to go ahead and perform the division.
William Rosener: So now I'm going to go ahead and run this. I've got 12 and a blank. And when I do that, it's only going to their message, please enter a value per second number. So then I could enter a number here. And if I do, sure enough, it's going to do.
William Rosener: Division there oh yeah we got left is the clear button.
William Rosener: Is simply taking these txt number one because an Australian
William Rosener: To
William Rosener: And I'll be I'll answer.
William Rosener: I'm setting all those just simply to the nostril. So now if I run that
William Rosener: Is it clear. Now notice that it's going to affect erase any information that was in these two text boxes or this label.
William Rosener: In all my stuff. Let me go back to the source code. It's really good idea, sometimes to document your kid. And if nothing else, maybe come up here to the top. I'm going to put a little single quote there.
William Rosener: Notice how that appeared in green and indicate an idea this was a comment or documentation. That's a good idea. Once you put them in.
William Rosener: That way, if you're kind of working in the same lab as someone else and you're having to printers out at the exact same time you'd make sure that you print out your print out as opposed to someone else's
William Rosener: OK, so those are the top two lines up there, the very top. Those are ignored. That's just comments documentation, just for your own personal use them. Okay, so I take a look here. One last time we created a couple text boxes a label. We had some of command button. So when I enter some values.
William Rosener: I can add a month.
William Rosener: I can subtract, multiply, and divide environment clear will find this first video you learned a little bit about Visual Basic and again come here just to show you one more time.
William Rosener: Visual Basic for the applications, also known as the VA there. So really, the language that we're using here is VB Visual Basic
William Rosener: That we're using them with that the Microsoft Office Suite and the main advantage to this is, you don't know shouldn't have to install the software. Hopefully you've already got
William Rosener: Microsoft Office install and if not, you're going to find. I've got a list of the reading to find it installed on every single initiative computer
William Rosener: And so what's going to do is allow you to easily create an application or take these applications to a new level by developing your own command buttons for the new. Well, anyway, I'll catch the next video. Thanks.