1
00:00:00,630 --> 00:00:01,570
Hello and welcome.

2
00:00:01,590 --> 00:00:10,010
In this lecture we are going to continue from where we left off in part one.

3
00:00:10,050 --> 00:00:10,380
All right.

4
00:00:10,380 --> 00:00:16,620
So I'm just going to change some more of the property values so if click on the label here I'm going

5
00:00:16,620 --> 00:00:19,770
to remove the text value which is this one here.

6
00:00:19,800 --> 00:00:26,760
I don't want it to say anything at the moment but just get rid of that and that should be gone next

7
00:00:26,760 --> 00:00:29,670
and I want to do is go to the buttons tab

8
00:00:32,860 --> 00:00:36,970
and I want to change the text on that button.

9
00:00:37,720 --> 00:00:41,140
Just make that okay button.

10
00:00:42,280 --> 00:00:42,940
Change that too.

11
00:00:42,960 --> 00:00:44,080
OK.

12
00:00:44,080 --> 00:00:44,400
All right.

13
00:00:44,410 --> 00:00:46,990
So I'm good.

14
00:00:46,990 --> 00:00:58,390
The next time we want to do we want to try and understand how they can be a data type assignment mismatch.

15
00:00:58,390 --> 00:01:02,870
So to do that double click on the okay button double click.

16
00:01:03,100 --> 00:01:07,890
And that should open up the code behind the button

17
00:01:11,860 --> 00:01:16,750
if you don't get this pop up immediately click you make sure you click on this.

18
00:01:16,750 --> 00:01:23,740
Default is default dot SB X dot see us make sure that is clicked on also before you double click on

19
00:01:23,740 --> 00:01:24,460
the button.

20
00:01:24,940 --> 00:01:26,280
If it doesn't come up.

21
00:01:26,320 --> 00:01:26,790
So right.

22
00:01:26,800 --> 00:01:29,770
So this is the this is shown all our code.

23
00:01:29,770 --> 00:01:35,200
So because we've clicked on the button you can see the mouse the cursor is flashing there because that's

24
00:01:35,200 --> 00:01:39,990
where it's asking us to insert some code.

25
00:01:40,030 --> 00:01:40,540
All right.

26
00:01:40,540 --> 00:01:46,800
So what I'm going to do I'm going to try and it's OK.

27
00:01:46,810 --> 00:01:51,180
So let's start with a data type of integer.

28
00:01:51,180 --> 00:01:51,580
All right.

29
00:01:51,580 --> 00:02:01,390
I'm going to give it a value of just the letter I type in the name the variable and then I am going

30
00:02:01,390 --> 00:02:12,880
to introduce a data type mismatch what I'm gonna do for the value of i I'm going to enter a string value.

31
00:02:15,460 --> 00:02:16,480
So I'm going to say

32
00:02:22,960 --> 00:02:24,490
hello world

33
00:02:36,310 --> 00:02:37,340
okay.

34
00:02:37,890 --> 00:02:42,350
And post semicolon at the end.

35
00:02:42,670 --> 00:02:43,360
All right.

36
00:02:43,410 --> 00:02:46,560
You can see Vicious to those complaining because of the squiggly lines.

37
00:02:46,980 --> 00:02:56,730
So in knows that I've got the wrong data type inserted the red squiggly on the line here indicates a

38
00:02:56,730 --> 00:03:03,970
compilation era where the application will not run as opposed to a green squiggly line.

39
00:03:03,990 --> 00:03:10,560
So if you have a green squiggly line that is just a warning does doesn't stop the code from running.

40
00:03:12,180 --> 00:03:21,360
The reason we have the red squiggly lines is because we are trying to put a string which is an alphanumeric

41
00:03:21,360 --> 00:03:32,550
characters into a variable that is only able to hold an integer an integer basically is a whole no value.

42
00:03:32,610 --> 00:03:35,980
So the variable is saying I'm not having that.

43
00:03:36,150 --> 00:03:43,620
So that we can't accept string values in this variable figure is quite good.

44
00:03:43,620 --> 00:03:47,540
If you hover your mouse over that it will tell you what's gone wrong.

45
00:03:47,710 --> 00:03:52,740
And you know basically give you a clue as to what's going on.

46
00:03:52,950 --> 00:04:00,990
So what are we going to have to do we going to have to do an explicit conversion an implicit conversion

47
00:04:01,020 --> 00:04:09,840
basically is done with data with data of all values of similar data types when they have similar data

48
00:04:09,840 --> 00:04:16,560
type like a string on a string or an integer an integer that is known as implicit whereas the data types

49
00:04:16,560 --> 00:04:17,220
are different.

50
00:04:17,220 --> 00:04:21,360
For example an integer and the string that is explicit.

51
00:04:21,390 --> 00:04:27,020
So we need to do an explicit conversion.

52
00:04:27,060 --> 00:04:40,590
So to to convert this value into an integer value we are going to use a method a method called convert

53
00:04:40,770 --> 00:04:43,970
dot to int 32 method.

54
00:04:43,980 --> 00:04:56,340
Basically what this method does it will convert the specify string to an equivalent 32 bit signed integer.

55
00:04:56,340 --> 00:05:04,680
So this is all going gonna do where we've got the variable I want to set it to equals to look type in

56
00:05:04,680 --> 00:05:05,850
the world convert

57
00:05:08,760 --> 00:05:09,540
uppercase

58
00:05:12,150 --> 00:05:18,630
convert dot you notice it's the intelligence has given us an idea.

59
00:05:18,660 --> 00:05:19,620
This is what I want.

60
00:05:20,040 --> 00:05:24,480
So I'm gonna convert convert dot to 32.

61
00:05:24,540 --> 00:05:25,570
That's the method.

62
00:05:25,620 --> 00:05:32,070
And then in parentheses I'm going to includes the text.

63
00:05:32,070 --> 00:05:33,900
I want to convert.

64
00:05:34,230 --> 00:05:40,290
So if she can see this quickly red squiggly lines has disappeared because we've now used this convert

65
00:05:40,290 --> 00:05:50,000
dot to into 32 method to convert this text hello world into an integer value.

66
00:05:50,910 --> 00:06:05,760
So this value now is equivalent to a 32 bit signed integer so a 32 bit side integer is also equivalent

67
00:06:05,760 --> 00:06:11,070
to the number in the value or a zero.

68
00:06:11,070 --> 00:06:13,200
If the value is no.

69
00:06:13,780 --> 00:06:18,890
So I'm just going to go in to design you for a minute or just scroll down

70
00:06:22,950 --> 00:06:30,620
and in the design of your what I'm trying to achieve here this text box here the text box input it will

71
00:06:30,620 --> 00:06:38,270
store users the input as a string but what I'm trying to achieve here I want doors to be able to convert

72
00:06:38,330 --> 00:06:47,030
that string into an integer so we can performs some calculation on it the label control which is this

73
00:06:47,030 --> 00:06:48,200
one here.

74
00:06:48,200 --> 00:06:50,610
So the result as a string.

75
00:06:50,720 --> 00:06:58,430
So we will also want to convert the results of the into calculation back into a string.

76
00:06:58,430 --> 00:07:03,330
So we're going to see if we can achieve that in the next lecture.

77
00:07:03,470 --> 00:07:05,720
So that's it for this lecture.

78
00:07:05,720 --> 00:07:06,640
Thanks for watching.

79
00:07:06,950 --> 00:07:07,540
Bye for now.
