How do these parameters even work?
I have a project where I need to transfer information from my GUI's textbox and turn it into an average(census) but I have to do it from a class file. Our professor gave us this method with parameters and told me to pass the information but i don't know how and its messing up my code.
5 Replies
@Hensoro , can you provide the compilation error? Also, it would be really nice to elaborate more on the question, some more details can really matter getting an accurate response
you can think parameter as of the key, and the method is the house with different set of lock. as long as you know the what lock is, you can create that key.
if you want to call the method it means you need to call it for specific lock
also if you have to call a method from a class you can think of this class as the owner of this house,
for example if you have avarage class
of course each owner have different personality, you can think of avarege class = introvert so you need to make a relatioshop first (we always call this create a new object). and if the class is static like below you can think of it as extrovert person. just call it by name and he always reply to you
sure, The question is what is the purpose of the convert 32 in the parameters and is there a way to call on it in my method?
There are a lot of problems in this code. I think you should refollow it with your professor in order to understand it's purpose.
It's hard to understand from here why is text being passed to an int parameter (that's why there is a convert there, txtNumBaths.Text is a string!
ProcessHouse
receives an int HouseNum
) also, the compilation error is referring to a value for a parameter that's missing, it was probably forgotten and must be provided to call the method.Thats kinda what im confused about is if i dont need to refer to the .text then how will i refrence it in my code do i just put NumBaths as is? i tried asking my professor and he was like vague which is confusing me more
Like i thought that the parameters would be some kind of variable that i can plug into the method but idk how to do that