Hello and welcome.
In this lecture we are going to be writing some code for the Load event handler method.
So switch to your design mode.
Just click on the form design make sure you've got the form selected.
You can tell by the name of the form and click on this here.
This little thing that looks like a thunder lightning bolt.
We need to scroll down to a point.
Oh this is what we're looking for because what we're looking for this is the Load event right.
So when the page loads.
So with this is what we want to generate could force we just double click on it and it will create a
stop a stop.
Basically is an empty method.
So this is an method is created is empty because we've not written the code that will go in between
the curly braces.
What I'm going to do.
I am going to write the code added on and explain it to the highlighted code is what I have chosen added
on.
So I'm just going to explain it to make sure when you write your code make sure the curly braces match
up if not reduced you to complain and it will not compile your code so you can see you know the.
My curly braces.
They all match up.
So let's start with the first line of the code which is this one here.
Basically any time you see square brackets know that that is referencing an array referring to an array.
So what this line of code is basically this code is going to put a list of all the fine finally all
the found names in the picks directly remember we created the directory for our images and call it picks.
So it will put or put a list of all the file names in the picks directory to the images variable.
OK.
So this is a variable image is created a variable here called images.
We've set it to this.
So what it will do.
It will get all the pictures all the images from this directory picks and dump it and store it inside
this image.
Images variable on line 41 here have introduced a for each a four which is a kind of loop.
So it will loop true.
Here is going to this image here which is the it will loop through that image and it will each time
we loops through.
It will create an instance of that image.
So here is looking for each a string basically is a text a string of text.
So it is looking for each text you know in the image is text in the image in images.
This image is is this variable here.
So that's what this string is looking for the text in the image in this image is variable.
Line 4 2 3.
This line here.
What that highlighted line does it creates a new bit map picture and then adds it to the beachy images
array.
Remember we created an array earlier on in our previous lecture which is this peaky images array.
All right.
I've also introduced a for loop here.
This line here is a for loop a for loop basically line inside the palace parentheses
past it.
There is a data type of integer which is a number a loop basically will go through each return item
and count to what it is doing here.
I've given it a variable of I and I have set the initial value to zero.
So this is the value of the counter.
So to start counting from zero.
And here I'm calling the same variable here.
I'm saying as long as this variable if it's less than 50 I wanted to keep increasing by 1 plus plus
men increased by wants me to keep increasing the variable.
So what that will do it will look in the directory for the images and it will check as long as the images
are less than 50.
It will keep adding adding images to the screen until it reaches 50.
So this value you can experiment with and see you know what gets displayed on the screen later but basically
that's what this county.
It will stop when the images are above 50 here on line 48.
So this is a class and this is a local variable.
And I've set a new instance of that local variable and you say this is a method is going to equals to
this Brit pick method here on line 49 I've got this local variable here MP and set it to this the percent
actually means remainder.
So 5 percent of 2 is 1 because you can divide 5 into 2 twice with a reminder of 1
on line 50 here.
The one highlighted.
Basically what the line that code was going to do.
He's going to get the next available random number between zero and the windows with the one next to
it will do the same next available number and the windows height Oh don't worry about this line here.
I've commented out so it doesn't matter anyway.
Just get rid of it so it doesn't confuse you.
I was just trying to test some things out so I get rid of that on here we are we've got a method here
that adds an object to the end of the list.
All right.
So use this method if you want to append a list to is good.
If I wanted to add this here will add an object to the end of this variable.
Here is brick picks.
Class variable so any way you're using add you are appending or adding to a list.
So this is an array.
So by adding the add here it will add an object to the end of that list.
So that is it for this lecture.
I'm gonna stop this lecture here and we will progress in the next lecture.
Thank you so much for watching.
Take care.
Bye for now.