minute 17 you missed wiring up your model view to the view throw the code behind using DataContext or static resource in the view.
@Tall-Cool-Drink
4 жыл бұрын
Try to store a zipcode that starts with a "0" into a Zipcode that is defined as an integer.
@Tall-Cool-Drink
4 жыл бұрын
why is ZIPCODE an int? Will it be used in a calculation?
@CampNerd
4 жыл бұрын
Numbers are always int (internet) also when you use a number within an index it always starts with 0. So for example if you have two zip codes then you have to use int. When you reference that int and you use an index of 2 (two zip codes) in code you would reference as 0 and 1... new coders will get an error thrown when they reference 1 and 2. The code sees the 2 as there being three zip codes (0, 1, 2) that will throw an out of scope. So remember with integers always defense numbers starting from 0 as the first. I know you was asking about why int was used but this goes with it when you have 100’s of zip codes and you keep getting an error.
@Tall-Cool-Drink
4 жыл бұрын
@@CampNerd When a zipcode starts with a 0, as in some NorthWestern states, how do you keep the first 0 in an int? Doesn't int ignore leading 0s? Example: integer 0987 is kept as 987. It drops the leading 0. Am I missing something?
@CampNerd
4 жыл бұрын
@@Tall-Cool-Drink the zip code has nothing to do with the code.. you use an index to place the value. For example, 0=xxxxx then 1=xxxxx and then 2=xxxxx.... it does not matter what numbers you use. You are referencing the index number. That index number the place whatever the zip code is. You can do the same with words, sentences, etc... if a zip code starts with 0 it does not effect the code.. so if 09567 is the zip code then the index starts at 0 and works it’s way down to find the y=xxxxx so if you had 100 zip codes the program starts the search at 0 and ends with 99.. so let’s say the code I given above is located in the list the code will see index number 76=xxxxx... if that code was the very first as in 0 then the code sees 0=xxxxx... now if you place your index as 100 items in the list it will show an error because it’s 0-99 the list always starts with 0 and works it’s way down.
Пікірлер: 6