Welcome back.
All right, let's get started.
So what we're going to build in this video is going to be this currency converter that you can see here.
And you hopefully have seen part one in which we have basically built what you can see here in this
tab, which is a basic currency converter.
But in video one, we use static data and this time we're going to use a database.
So we are going to extend the functionality here and we'll have two different tabs.
So one tab for the currency converter itself and then another tab in which we can enter the different
exchange rates or the values that are assigned to a specific currency.
So here, for example, euro is the base value, and for €100 I get €100, very basic, but then for
100 USD I can get €85.
For £100, I can get €111.
Okay, So this is how the database is set up.
You can, of course, then later on decide to adjust the database to your liking.
You can delete entries from your database with this UI as well as you can edit entries in the database
from this UI directly.
And the cool thing is you will learn the fundamentals of databases.
You will learn a little more about WPF.
And by the way, I highly recommend that you check out Video one, because I'm not going to go into
too much detail when it comes to WPF code, so into what happens in Xaml, because this is what we have
built in the last video, this user interface that you can see here.
But as you see, we now have tabs, which is one new thing that we are going to introduce.
And then we have this grid here.
Which is a.
Data grid.
And we are going to use this data grid in order to display data from our database.
So we're going to set up a SQL database and then we're going to get the data from the database and put
it here.
We're going to be able to make adjustments.
So editing and deleting and all of the good stuff.
All right.
So now I have these three currencies here, and now I could look into how many euros do I get?
For example, for 100 Indian rupees.
So Indian rupees in euros that would be roughly 1.13.
So let's just say I get ₹1.
For €100.
Let's put it in there.
And actually did it make a change to the US dollars?
Because I clicked on that row.
But now if I create a new one here, let's create US dollars once again.
So the amount was I think 88, even though I'm not sure, it doesn't really matter.
It's more about the core functionality.
And you can see now we have US dollars in there as well.
If I now go to the currency converter, I can select off those values that I have in here.
So these currency names now appear in my combo box and I can now select whatever I want.
So for example, how many euros do I get for ₹1,000?
Well, it says ten.
Okay, so how many?
Dollars do I get for €1,000?
1136 even though it's a little more right now.
But yeah, currency rates are fluctuating a lot.
So you could use this software in order to then go ahead and adjust those settings every single day.
And then you would have the daily rates and you could use that currency converter.
Of course, this is manual work that is involved in order to do that and to get the current values and
the current data.
And of course, you would use Google instead of this currency converter.
But basically what this allows you to do is to.
Create any type of database software that you want to use and based on the knowledge that you will gain
in this video, you can then go ahead and build your own more complex database using software and you
could go ahead and sell that software.
Very good stuff.
All right.
So either way, I'd say let's get started building this.
And as always.
At least almost always with my videos, you can find a complete article with all of the code on my blog,
and I'm going to add a link in the description down below.
You can find it there and you can then just follow along the guide in text form if you prefer that you
can find all of the code in there if you don't want to type it manually and all of the good stuff.
So of course we're going to set up.
A database in this video, so you will need to know how to set up the database.
You can follow along here.
But of course, I'm going to show you all of that in the video as well.
Okay.
But still, check out the website.
And yeah, let's get started.
And as I said, I'm going to use the code from the last video that we had used.
And if you don't have the code from the last video, well, you can just watch the other video and follow
along because it really makes sense for you to understand or you can just copy the code from the website
and you don't have to type it in manually.
I'm not going to go into too much detail what's going on here.
I'm not going to explain this UI, I'm just going to explain the other UI, which is the second tab
that we have here.
All right.
So I'm going to explain what's going on in this tab, but I'm not going to go into too much detail.
All right.
I will go, however, into detail when it comes to databases.
Okay.
Because this is really the focus of this video.
It's not really the WPF, but I think it still makes sense to look into WPF just a little bit.
Okay.
Now enough mumbling and grumbling.
Now let's get started with adjusting our UI.
So the first thing that we will need to do is we need to have tabs and in order to add tabs to our UI,
to our window, we need to add something called tab control.
And where am I going to do that on the highest level?
So this is where the window tag.
Starts.
And here inside of our window tab, we have this grid, okay?
And this grid is basically our whole UI.
So in the last video, everything that we had was a bunch of stacked panels inside of our grid with
five rows.
Now I want to put this whole screen into one tab.
So everything that we had so far should be in one tab.
So let me put the whole grid away.
So now you can see it's limited to just one line.
I clicked on this minus here and now I'm going to use something called tab control and I'm going to
give this a name.
I'm going to call this Tab Main.
So Tab Main, and I'm going to use this property here called Tab Strip Placement.
What it does is it allows me to basically say where I want to have the tab and I want to have the tab
at the top because that's where you would expect it on a PC.
Usually you have tabs at the top.
Okay, So this is going to be the basic tab control and inside of a tab control, I can have multiple
tabs.
Okay.
And the different tabs that I want to have are tab items and I can again give them a name.
So I'm going to call this one converter and I'm going to give it a header so that we know what to make
with this.
So what it is about, so converter is going to be the name of this tab item.
So let me now drag this whole grid here.
I'm going to paste it all inside of this tab item.
Okay, So let me close it.
You can see now this whole grid is inside of this tab item called converter with the header saying.
Currency converter.
So let me start this software just to see if it actually works.
And if we now actually have a tab, you can see now we have this new tab called currency converter.
Well, that's not the name of it, but that's what it says.
And that's what this header is.
Okay.
So internally the name is TB converter, but what is written here is this header property.
Now a little challenge for you.
Create another tab inside of this tab control.
So pause the video and try it for yourself.
I can really recommend to always try these things directly after you have learned them.
Okay, so I'm going to basically create a new tab item.
So new tab item.
And let's see what would be a good name for this.
So tab item would be name and I'll call this one TB master.
So tab master and the header will be currency master.
Okay.
This is what you can create the currencies and we can start with something very simple.
Let's just put a label in there just to see that something is in there, that it works.
Okay, so I'm just going to put a label in there with the content of Hello.
World's.
All right.
And now let's save it.
Let's refresh.
Hot reload.
Well, actually, it doesn't work for me like that, so I need to stop it and start it once again.
And now.
I can go to my currency master.
You see, the tab exists and I see that there is this label in there which says Hello world, all right?
And that is how you can create different tabs very easily.
That's how simple it is.