473,406 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

C# Questions

Hi everybody.

I am new to C#, I come from a VB 6 background, so there are some pretty big
difference that I need to get used to, so please bear with me if my
questions are simple.

1. In my C# application, I use a monthCalendar. What I basically want is
when I click a day in the week, it must highlight that whole week for me
automatically. Now I managed to get to pass the date that was selected by
the user, but what I want to do is determine the date of the first day in
that week. i.e. if I select the 06/11/2003(Thursday), and my first day of
the week is Monday, then I want my method to figure out the date of Monday
and set the monthCalendars start and end date from Mondays date - Sundays
date. I do not know how to do this. I see that the DateTime class has
AddDays,AddMonths etc, but I do not see anything for SubtractDays or
SubtractMonths etc. I do see that there is a Subtract method, but I can only
get it to work if I already know what Mondays date is! Any help would be
SOOOO appreciated.

2. I know that in VB6, if I ran my app, and there was an error in the code,
I could pause the app, fix the problem, or even add in extra lines of code,
and carry on executing, however in my C# app, when there is a problem, or I
come to a breakpoint, and I want to change something, or add new lines of
code, it asks me whether I want to restart, or continue, If I restart, the
app closes down and is re-run, if I choose continue, the app carries on, but
ignores my changes or additions. Am I doing something wrong? Why do I need
to restart the whole app for my changes to take effect. Again, any info is
greatly appreciated

TIA for your help

Kevin
Nov 15 '05 #1
2 1494
Kevin <ke************@absamail.co.za> wrote:
I am new to C#, I come from a VB 6 background, so there are some pretty big
difference that I need to get used to, so please bear with me if my
questions are simple.

1. In my C# application, I use a monthCalendar. What I basically want is
when I click a day in the week, it must highlight that whole week for me
automatically. Now I managed to get to pass the date that was selected by
the user, but what I want to do is determine the date of the first day in
that week. i.e. if I select the 06/11/2003(Thursday), and my first day of
the week is Monday, then I want my method to figure out the date of Monday
and set the monthCalendars start and end date from Mondays date - Sundays
date. I do not know how to do this. I see that the DateTime class has
AddDays,AddMonths etc, but I do not see anything for SubtractDays or
SubtractMonths etc. I do see that there is a Subtract method, but I can only
get it to work if I already know what Mondays date is! Any help would be
SOOOO appreciated.
To subtract days, just call AddDays with a negative value.
2. I know that in VB6, if I ran my app, and there was an error in the code,
I could pause the app, fix the problem, or even add in extra lines of code,
and carry on executing, however in my C# app, when there is a problem, or I
come to a breakpoint, and I want to change something, or add new lines of
code, it asks me whether I want to restart, or continue, If I restart, the
app closes down and is re-run, if I choose continue, the app carries on, but
ignores my changes or additions. Am I doing something wrong? Why do I need
to restart the whole app for my changes to take effect. Again, any info is
greatly appreciated


There's no edit-and-continue in either VB.NET or C#, although there
will be in VB.NET in the next version of Visual Studio .NET. As for why
this is - there's an awful lot going on under the covers, and changing
code in the middle of execution is not a simple task by any means.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #2
Hi Kevin,

"Kevin" <ke************@absamail.co.za> wrote in message
news:O5****************@TK2MSFTNGP12.phx.gbl...
Hi everybody.

I am new to C#, I come from a VB 6 background, so there are some pretty big difference that I need to get used to, so please bear with me if my
questions are simple.

1. In my C# application, I use a monthCalendar. What I basically want is
when I click a day in the week, it must highlight that whole week for me
automatically. Now I managed to get to pass the date that was selected by
the user, but what I want to do is determine the date of the first day in
that week. i.e. if I select the 06/11/2003(Thursday), and my first day of
the week is Monday, then I want my method to figure out the date of Monday
and set the monthCalendars start and end date from Mondays date - Sundays
date. I do not know how to do this. I see that the DateTime class has
AddDays,AddMonths etc, but I do not see anything for SubtractDays or
SubtractMonths etc. I do see that there is a Subtract method, but I can only get it to work if I already know what Mondays date is! Any help would be
SOOOO appreciated.
Here's an example:

DateTime dateNow = DateTime.Now;
DateTime dateMonday = dateNow.AddDays(DayOfWeek.Monday -
dateNow.DayOfWeek);

Console.WriteLine("Monday's date: {0}", dateMonday);

If dateNow is the date of a day in a certain week, then dateMonday is
the date of Monday in that week. If you wanted Sunday to be treated as the
last day of the week, you'd have to finagle this a bit, but you get the
idea.
2. I know that in VB6, if I ran my app, and there was an error in the code, I could pause the app, fix the problem, or even add in extra lines of code, and carry on executing, however in my C# app, when there is a problem, or I come to a breakpoint, and I want to change something, or add new lines of
code, it asks me whether I want to restart, or continue, If I restart, the
app closes down and is re-run, if I choose continue, the app carries on, but ignores my changes or additions. Am I doing something wrong? Why do I need
to restart the whole app for my changes to take effect. Again, any info is
greatly appreciated


You are not doing something wrong. "Edit and Continue", as it is called,
is not a feature of any .NET language including VB.NET. I believe E & C
will be supported for VB.NET only in .NET 2.0 (due sometime in the latter
part of 2004).

Regards,
Dan
Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: softwareengineer2006 | last post by:
All Interview Questions And Answers 10000 Interview Questions And Answers(C,C++,JAVA,DOTNET,Oracle,SAP) I have listed over 10000 interview questions asked in interview/placement test papers for...
0
by: connectrajesh | last post by:
INTERVIEWINFO.NET http://www.interviewinfo.net FREE WEB SITE AND SERVICE FOR JOB SEEKERS /FRESH GRADUATES NO ADVERTISEMENT
2
by: freepdfforjobs | last post by:
Full eBook with 4000 C#, JAVA,.NET and SQL Server Interview questions http://www.questpond.com/SampleInterviewQuestionBook.zip Download the JAVA , .NET and SQL Server interview sheet and rate...
4
by: Drew | last post by:
I posted this to the asp.db group, but it doesn't look like there is much activity on there, also I noticed that there are a bunch of posts on here pertaining to database and asp. Sorry for...
8
by: Krypto | last post by:
Hi, I have used Python for a couple of projects last year and I found it extremely useful. I could write two middle size projects in 2-3 months (part time). Right now I am a bit rusty and trying...
0
by: ramu | last post by:
C# Interview Questions and Answers8 http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers8.html C# Interview Questions and Answers7...
1
by: ramu | last post by:
C# Interview Questions and Answers8 http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers8.html C# Interview Questions and Answers7...
0
by: ramu | last post by:
C# Interview Questions and Answers8 http://allinterviewsbooks.blogspot.com/2008/07/c-interview-questions-and-answers8.html C# Interview Questions and Answers7...
0
by: reema | last post by:
EJB Interview Questions http://interviewdoor.com/technical/EJB-Interview-Questions.htm CSS Interview Questions http://interviewdoor.com/technical/CSS-Interview-Questions.htm C Interview Questions...
0
by: reema | last post by:
EJB Interview Questions http://interviewdoor.com/technical/EJB-Interview-Questions.htm CSS Interview Questions http://interviewdoor.com/technical/CSS-Interview-Questions.htm C Interview Questions...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.