« first day (2046 days earlier)      last day (2894 days later) » 

user6096770
10:01 PM
hello guys
 
user6096770
anyone know what the problem is with my code?
 
user6096770
2
Q: MVC5 Cannot use two models in one view

FluffyWuffyTheres links already on how to use multiple models for a view with different ways to do it, however, I tried those and could not get them to work, what am I doing wrong? I simply want two form inputs in 1 view, and one model, but one of the form inputs uses a list<'model'> and the other uses 'mo...

 
10:14 PM
@FluffyWuffy Put 2 Models in one Viewmodel -> problem solved
 
user6096770
I did, and the code has 0 exceptions, but when you run it it crashes when trying to submit checkbox items, not sure wtf is going on
 
10:41 PM
What do you mean "it crashes"
 
user6096770
error: Model.input.passWord: Object reference not set to an instance of an object.
 
that is an exception
so it's not getting 0 exceptions
 
user6096770
you are right
 
user6096770
copy/paste the code, try it out
 
Why don't you debug your code?
 
user6096770
10:44 PM
I tried, don't know what it means, I'm a beginner MVC
 
and find out why you're dereferencing a null object?
you don't know what what means
debugging?
you don't know what debugging means?
 
user6096770
i do, but when i debug it i don't even know wtf is going on
 
well I'm sorry, but my crystal ball is in the shop for repairs today
so I'm going to need you to ask a more specific question based on things you don't understand from observations made during your debugging
 
user6096770
don't worry about it man, I just wanted to put multiple form inputs in a single view as simplest as possible while returning in string what the user inputted to verify, that's pretty much it
 
Hey, I don't mind helping people out but you got to put in a minimum amount of effort to get it. I don't have time to guess why your code is failing if you don't have time to tell me what happens when you debug it and what part of the happenings you don't understand
For example, your error says Model.input.passWord
is the Model object null? is the input member null? How should I know?
Unless I debug your code
which is what I'm asking you to do so you can get some help.
 
user6096770
thanks, but ima go learn javascript now, i give up on MVC it's too complicated
 
I come back from vacation and team notifies me that they're now using git over TFS. Problem is... merging with Git is hell now :O for some reason, it shows that the user has edited the whole file instead of the minor code change
 
user6096770
nobody uses MVC for a reason, and getting help for it is difficult too, I'm trying to do the simplest beginner stuff and theres little support/documentation
 
@ReedCopsey is there a reason those links are directed at me?
 
sorry - mistake
should've been to @FluffyWuffy ;)
 
10:57 PM
@FluffyWuffy You're not going to find a lot of sympathy MVC bashing in here. IIRC, StackOverflow is made with MVC
 
@FluffyWuffy There is also probably more documentation for MVC than just about anything else out there
 
@FluffyWuffy, what's your MVC question?
I haven't done MVC in a while but it's not too bad
Trust me, I'm working with Xamarin lol
 
user6096770
i only want to put in form inputs in one view, and it's nearly impossible to do, basic stuff man
 
user6096770
the documentation is garbage, ive spent 5 days already on this and i can get 1 form input at a time on one view, but putting multiple is a disaster
 
user6096770
10:58 PM
i don't bash without reason
 
The documentation is NOT garbage. I came right out of school 3 years ago and dived head first into MVC with no web development experience and don't regret a second of it.
I've tried to help you, but you just want to rage rather than cooperate.
 
user6096770
this is my attempt at putting two form inputs in one view http://stackoverflow.com/questions/37401427/mvc5-whats-wrong-with-multiple-models-in-my-single-view fkn disaster
 
user6096770
well i kinda don't want your help man, you can copy/paste my code and figure out 2 form inputs and get back with the answer or choose to ask 21 questions, i rather find someone that will get to the answer
 
You mean you'd rather find someone to do your job for you and spoon-feed you your programming skills rather than taking the initiative and learning independently.
If I compile your code for you and give you an answer can I have your paycheck too?
 
user6096770
i can pay you, i was looking at hackhands for a sec but i think i might try them
 
11:06 PM
If I have string varName = "someName"; and string someName = "some string";
How can I print someName using varName?
 
Rob
Reflection
Assuming someName is not a local variable
 
No it's a public const
 
Rob
Then yes, reflection will do it for you
public class MyTest
{
	public const string someName = "some string";
	public void DoIt()
	{
		var varName = "someName";
		Console.WriteLine(GetType().GetField(varName).GetValue(null));
	}
}
 
ctrl+K
(prefix each line with 4 spaces)
 
Rob
Ah cheers, didn't know that worked in chat
 
11:15 PM
Hmm but what if the string is in a different class? I tried classname.GetType.. but that obviously won't work.
 
How many classes do you want to check and where are they defined?
 
Rob
typeof(classname)
 
Oh nvm I misunderstood the last question
I thought you were wanting to scan all types in an assembly or something, (for which I usually do something like typeof(SomeParticularClassOfInterest).Assembly.GetTypes() )
 
MessageBox.Show(typeof(ItemStrings).GetType().GetField(varName).GetValue(null))‌​; Still doing something wrong here. Sorry I'm still learning. Really feel like a noob right now.
 
Rob
Remove the GetType()
GetType() is for instances, typeof() is for types directly
typeof().GetType() will get you the type of the type object (confusing, I know)
 
11:22 PM
Ok, so now I've System.Windows.MessageBox.Show(typeof(ItemStrings).GetField(varName).GetValue(n‌​ull)); but it returns: Cannot convert from object to string
 
Rob
Now you need to cast it
System.Windows.MessageBox.Show((string)typeof(ItemStrings).GetField(varName).Ge‌​tValue(n‌​ull));
 
Ah, yes that fixed it. Finally something I knew. Casting xD
 
Rob
Just be careful.. it will break if varName points to a non-string constant
 
I know. But there aren't any other strings. It's a simple program that will return Admin commands for a game.
Anyway. Thanks a lot for your help @Rob Really appreciate it :)
 
Rob
No worries :)
 
11:55 PM
System.Windows.Controls.ComboBox cmb;

if (cbBoxAmmo.Visibility == Visibility.Visible)
{
    cmb = cbBoxAmmo;
}
else if(cbBoxArmor.Visibility == Visibility.Visible)
{
    cmb = cbBoxArmor;
}

ComboBoxItem SelectItem = (ComboBoxItem)cmb.SelectedItem;
Why does the last line return: Use of unasigned local variable cmb?
Never mind. I forgot it's because I didn't include the last else yet
 

« first day (2046 days earlier)      last day (2894 days later) »