DaClownie
DaClownie
CC#
Created by DaClownie on 6/16/2024 in #help
NullReferenceException but checking for Null?
Even better
23 replies
CC#
Created by DaClownie on 6/16/2024 in #help
NullReferenceException but checking for Null?
I’ll read those articles this evening and see if a more elegant solution is readily accessible or if I should just reorder and move on for now but find other times to implement the nullable reference types
23 replies
CC#
Created by DaClownie on 6/16/2024 in #help
NullReferenceException but checking for Null?
These are the little things my brain doesn’t catch yet. Nice little gotcha moment.
23 replies
CC#
Created by DaClownie on 6/16/2024 in #help
NullReferenceException but checking for Null?
Literally out of order. I was thinking out of order meant before passing it to the method
23 replies
CC#
Created by DaClownie on 6/16/2024 in #help
NullReferenceException but checking for Null?
OH
23 replies
CC#
Created by DaClownie on 6/16/2024 in #help
NullReferenceException but checking for Null?
And thank you for your help so far! You’ve done more than enough already if you don’t want to do that additional request. I appreciate the guidance
23 replies
CC#
Created by DaClownie on 6/16/2024 in #help
NullReferenceException but checking for Null?
I haven’t as that’s not something I’m aware of. Still learning and kinda fumbling my way through. I’d love to do some reading or learning if you have knowledge you’d like to share on what you’ve mentioned here or any articles that clarify what you’re suggesting clearly
23 replies
CC#
Created by DaClownie on 6/16/2024 in #help
NullReferenceException but checking for Null?
Which I’m thinking the more elegant solution would be to disable the add course button until conditions are met. For now though that can wait
23 replies
CC#
Created by DaClownie on 6/16/2024 in #help
NullReferenceException but checking for Null?
and then I'd remove the null checks from the ValidateCourseInfo()
23 replies
CC#
Created by DaClownie on 6/16/2024 in #help
NullReferenceException but checking for Null?
Which i'm sure there's a much more elegant solution which I can work through later, but that wouldn't dereference it before checking for null, correct?
23 replies
CC#
Created by DaClownie on 6/16/2024 in #help
NullReferenceException but checking for Null?
So if I wrapped this something like this:
private async void SaveCourseButton_Clicked(object sender, EventArgs e)
{
if (CourseName.Text is not null && InstructorName.Text is not null && InstructorPhone.Text is not null && InstructorEmail.Text is not null)
{
Course course = new Course(id, CourseName.Text, StartDate.Date, EndDate.Date, StatusPicker.SelectedIndex, InstructorName.Text, InstructorPhone.Text, InstructorEmail.Text, CourseNotes.Text, 0, 0);
var result = DataObjects.ValidateCourseInfo(activeTerm, course);
if (result.Length == 0)
{
SQLFunctions.AddNewCourse(course);
await Navigation.PopAsync();
}
else
{
await DisplayAlert("ERROR", result, "OK");
}
}
}
private async void SaveCourseButton_Clicked(object sender, EventArgs e)
{
if (CourseName.Text is not null && InstructorName.Text is not null && InstructorPhone.Text is not null && InstructorEmail.Text is not null)
{
Course course = new Course(id, CourseName.Text, StartDate.Date, EndDate.Date, StatusPicker.SelectedIndex, InstructorName.Text, InstructorPhone.Text, InstructorEmail.Text, CourseNotes.Text, 0, 0);
var result = DataObjects.ValidateCourseInfo(activeTerm, course);
if (result.Length == 0)
{
SQLFunctions.AddNewCourse(course);
await Navigation.PopAsync();
}
else
{
await DisplayAlert("ERROR", result, "OK");
}
}
}
23 replies
CC#
Created by DaClownie on 6/16/2024 in #help
NullReferenceException but checking for Null?
I'm checking for a null value on the fields that could potentially be blank, and if null, passing the error message back to be displayed, so I'm not sure why I'm getting the crash?
23 replies
CC#
Created by DaClownie on 5/21/2024 in #help
New ContentPages in .net MAUI app don't have InitializeComponent() methods
I’ll give that a try next time and see that if that resolves it rather than IDE restart. Thanks again!
17 replies
CC#
Created by DaClownie on 5/21/2024 in #help
New ContentPages in .net MAUI app don't have InitializeComponent() methods
What a weird bug.
17 replies
CC#
Created by DaClownie on 5/21/2024 in #help
New ContentPages in .net MAUI app don't have InitializeComponent() methods
@Absent_Reality closing and relaunching Visual studio seems to have fixed the issue. I battled this for hours this afternoon between google searches, looking at settings, deleting and recreating pages, etc.
17 replies
CC#
Created by DaClownie on 5/21/2024 in #help
New ContentPages in .net MAUI app don't have InitializeComponent() methods
namespace exists, its brand new, created by VS in the project, changed nothing. It auto adds the call for InitializeComponent(); but its not backed and the project won't build. I have to comment them out. I'm at a complete loss for what to do next
17 replies
CC#
Created by DaClownie on 5/21/2024 in #help
New ContentPages in .net MAUI app don't have InitializeComponent() methods
17 replies
CC#
Created by DaClownie on 5/21/2024 in #help
New ContentPages in .net MAUI app don't have InitializeComponent() methods
Just to test, I created A TestPage ContentPage XAML
17 replies
CC#
Created by DaClownie on 5/21/2024 in #help
New ContentPages in .net MAUI app don't have InitializeComponent() methods
Fairly certain I do, but I’ll remote in to my desktop in a bit and check. I added all my usings above the namespace right after creation if I remember correctly.
17 replies
CC#
Created by DaClownie on 5/21/2024 in #help
New ContentPages in .net MAUI app don't have InitializeComponent() methods
That’s where I’m struggling. When I add a page in VS, I’m also adding it as a ContentPage(XAML) and it is not creating the InitializeComponent method. It puts the call to it in the body of the class but it isn’t linked to anything. I figured I was doing something wrong.
17 replies