15,905,967 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by TomNidi (Top 15 by date)
TomNidi
5-Jan-11 15:16pm
View
:) I'm so stupid.. Well, you were right of course.
I just couldn't understand why it keep telling me that the input string is wrong, but when I went to check the info in the database, instead of one date I saw "?????". I had a problem with converting the right information, and it had NOTHING AT ALL to do with my function.
I would like to thank you for your time, and I hope that you will be able to help others same as you helped me:)
TomNidi
5-Jan-11 6:55am
View
Edit: The problem is in the "years" section, for example if I type "2011" instead of the "years" word in " d = d.AddYears(years - 1);", the problem is disapear, but I still can not set the child of my element host to the usercontrol. If I do it by the properties, the Visual Stuid crashes. If I do it by code, I get the error: "Object reference not set to an instance of an object.". and it yellows me the line I mention before - "foreach (Appointment appointment in (ObservableCollection<Appointment>)values[0])". Its like I changed something in it, witch I didn't..
TomNidi
5-Jan-11 6:41am
View
Well, I think I have just understood why this kept happening to me.. but I still don't know how to fix it.
The problem was in those lines in MonthViewCalendar.cs:
ap = new Appointment();
ap.Subject = reader["name"].ToString();
//
DateTime d = new DateTime();
int days = getDate(reader["date"].ToString(), "day");
int months = getDate(reader["date"].ToString(), "month");
int years = getDate(reader["date"].ToString(), "year");
d = d.AddYears(years - 1);
d = d.AddMonths(months - 1);
d = d.AddDays(days - 1);
ap.Date = d;
//
ap.Time = reader["startTime"].ToString();
ap.Dhifut = reader["dhifut"].ToString();
ap.AssignedFor = reader["assignedTo"].ToString();
ap.Type = reader["type"].ToString(); ;
ap.Description = reader["description"].ToString();
Appointments.Add(ap);
This is the GetDate function:
public int getDate(string date, string type)
{
string[] types = date.Split('/');
if (type == "day")
return Int32.Parse(types[0]);
else if (type == "month")
return Int32.Parse(types[1]);
else // type == year
return Int32.Parse(types[2]);
}
I still don't know why the designer won't load when I call this function.. the Date witch is stored in the Database witch I call the function on looks like this: "Days/Months/Years" - for example: "04/01/2011"
Do you know why this function keep causing me this problem?
TomNidi
5-Jan-11 6:02am
View
foreach (Appointment appointment in (ObservableCollection<Appointment>)values[0])
Same error line as before.
TomNidi
5-Jan-11 5:14am
View
Well, I think its the same error:
at CustomCalendar.AppointmentsConverter.Convert(Object[] values, Type targetType, Object parameter, CultureInfo culture) in C:\Users\Tom\Desktop\MyCalendar\CustomCalendar\CustomCalendar\AppointmentsConverter.cs:line 25
at System.Windows.Data.MultiBindingExpression.TransferValue()
at System.Windows.Data.MultiBindingExpression.Transfer()
at System.Windows.Data.MultiBindingExpression.UpdateTarget(Boolean includeInnerBindings)
at System.Windows.Data.MultiBindingExpression.AttachToContext(Boolean lastChance)
at System.Windows.Data.MultiBindingExpression.MS.Internal.Data.IDataBindEngineClient.AttachToContext(Boolean lastChance)
at MS.Internal.Data.DataBindEngine.Task.Run(Boolean lastChance)
at MS.Internal.Data.DataBindEngine.Run(Object arg)
at MS.Internal.Data.DataBindEngine.OnLayoutUpdated(Object sender, EventArgs e)
at System.Windows.ContextLayoutManager.fireLayoutUpdateEvent()
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.UIElement.UpdateLayout()
at System.Windows.Interop.HwndSource.SetLayoutSize()
at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
at System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
at MS.Internal.Designer.VSIsolatedDesigner.ViewHolder.Initialize()
at MS.Internal.Designer.VSIsolatedDesigner.ViewHolder..ctor(UIElement content)
at MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedView.get_ViewHandle()
at MS.Internal.Host.Isolation.IsolatedView.get_ViewHandle()
at MS.Internal.Designer.DesignerPane.LoadDesignerView()
If I uncomment my code I don't get this error, only the message that I mentioned on the tittle of the topic, and the designer doesn't show anything
TomNidi
4-Jan-11 16:46pm
View
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
if (values == null || values.Length < 2) return null;
DateTime date = (DateTime)values[1];
ObservableCollection<Appointment> appointments = new ObservableCollection<Appointment>();
foreach (Appointment appointment in (ObservableCollection<Appointment>)values[0])
{
if (appointment.Date.Date == date)
{
appointments.Add(appointment);
}
}
return appointments;
}
Still getting the same error...
Only when I delete the whole part inside of the public it shows me the user control with no problems at all, but still - I can not uncomment the code witch I commented at the begging in order to avoid errors, this is my main program code, with is in the MonthViewCalendar constructor public.
TomNidi
4-Jan-11 11:25am
View
The problem is probbably with the line "foreach (Appointment appointment in (ObservableCollection<Appointment>)values[0])", but I don't know how to fix it.
It seems that there is a null object witch I take actions on.
TomNidi
4-Jan-11 8:47am
View
Already read, waiting for a new answer.
TomNidi
4-Jan-11 8:31am
View
This is all I got in AppointmentsConverter.cs:
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
DateTime date = (DateTime)values[1];
ObservableCollection<Appointment> appointments = new ObservableCollection<Appointment>();
foreach (Appointment appointment in (ObservableCollection<Appointment>)values[0])
{
if (appointment.Date.Date == date)
{
appointments.Add(appointment);
}
}
return appointments;
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
Maybe the problem is with the "return appointments"? If so, what should I do in order to fix it?
TomNidi
4-Jan-11 8:13am
View
Well, I tried to commment everything except of the Public itself, and I got alot of wierd lookikng errors:
Title: An Unhandled Exception has occurred:
"Object reference not set to an instance of an object.
at CustomCalendar.AppointmentsConverter.Convert(Object[] values, Type targetType, Object parameter, CultureInfo culture) in C:\Users\Tom\Desktop\MyCalendar\CustomCalendar\CustomCalendar\AppointmentsConverter.cs:line 23
at System.Windows.Data.MultiBindingExpression.TransferValue()
at System.Windows.Data.MultiBindingExpression.Transfer()
at System.Windows.Data.MultiBindingExpression.UpdateTarget(Boolean includeInnerBindings)
at System.Windows.Data.MultiBindingExpression.AttachToContext(Boolean lastChance)
at System.Windows.Data.MultiBindingExpression.MS.Internal.Data.IDataBindEngineClient.AttachToContext(Boolean lastChance)
at MS.Internal.Data.DataBindEngine.Task.Run(Boolean lastChance)
at MS.Internal.Data.DataBindEngine.Run(Object arg)
at MS.Internal.Data.DataBindEngine.OnLayoutUpdated(Object sender, EventArgs e)
at System.Windows.ContextLayoutManager.fireLayoutUpdateEvent()
at System.Windows.ContextLayoutManager.UpdateLayout()
at System.Windows.UIElement.UpdateLayout()
at System.Windows.Interop.HwndSource.SetLayoutSize()
at System.Windows.Interop.HwndSource.set_RootVisualInternal(Visual value)
at System.Windows.Interop.HwndSource.set_RootVisual(Visual value)
at MS.Internal.Designer.VSIsolatedDesigner.ViewHolder.Initialize()
at MS.Internal.Designer.VSIsolatedDesigner.ViewHolder..ctor(UIElement content)
at MS.Internal.Designer.VSIsolatedDesigner.VSIsolatedView.get_ViewHandle()
at MS.Internal.Host.Isolation.IsolatedView.get_ViewHandle()
at MS.Internal.Designer.DesignerPane.LoadDesignerView()"
Wow.... What else?
TomNidi
4-Jan-11 8:09am
View
I can not remove anything from the list you have mentioned.
If I remove the tag close from the line " < local:MonthViewCalendar/> ", it throws me the next error: "Closing tag for element '<local:monthviewcalendar>' was not found.".
If I remove the xmlns:local line, it shows me the error: "The type 'local:MonthViewCalendar' was not found. Verify that you are not missing an assembly reference and that all referenced assemblies have been built ".
None of the rebuilds actually helped.
What shell I do?
TomNidi
4-Jan-11 8:05am
View
I didn't get where should I put it. What is the constructor?
Anyway, even if I put it I'm not able to set the child of my element host to the user control, and therefore I can not make the code start.
Can you explain a little bit more? Thank you.
TomNidi
4-Jan-11 2:36am
View
I didn't get your question, sorry for not understanding - my english is not that good.
TomNidi
3-Jan-11 15:43pm
View
I know these code is not the best, but I don't have a problem with it right now.
When I go the the designer in order to view the code of the control, it doesn't show me the usercontrol and underlines the line "< local:MonthViewCalendar/>" with the error "Could not create an instance of type MonthViewCalendar".
TomNidi
30-Dec-10 15:17pm
View
I guess it is an mysql database.. when I add a file using Visual Studio C# express edition I select the Server-based Database, witch is an mdf type.
Show More