|
i want to get the 7 dates of week. like if today is the 6 jan in calendar control 2nd day of current week. i want to get all the 7 dates from monday to sunday from(5-01-04 to 11-01-04)how can i get thoes dates from calender control.did u get my point or not.
thank you.
do it man
|
|
|
|
|
First of all, Tuesday, January 6th, 2004 is not the 2nd day of the week in the en-US culture - nor in many other cultures - it is the 3rd. This all comes down to culture-specific information. Use the following to get what the day of week is for the specific culture:
CultureInfo culture = Thread.CurrentCulture;
int dayOfWeek = (int)culture.Calendar.GetDayOfWeek(DateTime.Now); An enum like DayOfWeek can be cast to an int . In this case, the DayOfWeek members correspond to the number for the week, i.e. Sunday = 0, Monday = 1, Tuesday = 2, etc. You should add 1 to this value since most people think in base 1, not base 0.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thank you very much for your help
could u give me some help that how can i create a Year View calendar in ASP.net in which i can show the user all the 12 month of a year and can navigate through diff years.
Thank you once again for your help.
do it man
|
|
|
|
|
This isnt really a question relating to C# but the application that I am working on is written in C# and there isnt really another forum section which is relevant to my question.
Within my application I am taking various values pulled from an MS SQL database and creating a comma delimited CSV file, the problem is that the values in the db have various /n and and /r. In previous versions I have simply stripped this out as if they are present it causes the stream writer to generate incorrect CSV's. The problem is that, as a result of stripping these out, I loose any formatting.
An example is this query :
SELECT val1, val2, val3, val4 FROM table
The code then generates the following CSV file :
val1, val2, val3, val4
abc, def, ghi, jkl
Does anybody know of a way of creating the CSV with the /n and /r included? Double Quoting? Escaping?
post.mode = signature;
SELECT everything FROM everywhere WHERE something = something_else;
> 1 Row Returned
> 42
|
|
|
|
|
Use a TextWriter and while writing each line, parse the string for each delimited value. If it contains a quote, carriage return, or line feed, quote the string. In the case that it does contain a quote, double-quote it. There really is no other escaping defined for common CSV (keep in mind there's really no "standard"). Excel displays carriage return, line feeds as boxes but a lot of other programs should accept it.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi everyone
I have a problem when i try to read from database. the exception message says
Unspecified error: E_FAL_(0x80004005)
any one can help me?
Error image
Error image
|
|
|
|
|
What is your code that this happend and which line?
Mazy
No sig. available now.
|
|
|
|
|
The code is included in this file
the error message is also here
regards;
|
|
|
|
|
Hi members,
I would like to ask is there any fast way to get the intercept point of any 2 lines?
I have drawn many lines over the screen, and now want to point the red color circle on their intercepts.
Could someone give me some idea?
Thanks for help
|
|
|
|
|
What you need to do is solving linear equations. As you (may) know from college mathematics, the equation of a straight line on a X-Y plane has the following form:
y = kx + b
unless it is a vertical line, in which case the equation has the form
x = b
Here k and b are constants. If you know the equations of the two lines, then the coordinates of the intersecting point (if exists) will be the solution (x, y) of these two equations. So what you need to do is:
a) Find the equation of the two lines.
b) Determine if they have an intersecting point.
c) Find the intersecting point by solving these two equations for x and y.
a) You need to know two different points on each line. Say (x1, y1) and (x2, y2). If x1 = x2, then the line is vertical, the equation is x = x1. Otherwise, the equation is y = kx + b, where k = (y2-y1)/(x2-x1) and b = y1 - x1(y2-y1)/(x2-x1).
b) Suppose you already have the equations of the two lines: y = k1 x + b1 and y = k2 x + b2. If k1 = k2, then the two lines are parallel (there is not intersecting point). If the two lines are both vertical, then there is no intersecting point either. Otherwise the intersecting point exists (but it may not be on the screen, it may be 200 miles away).
c) After a) and b), you can solve the two equations to get the coordinates of the intersecting point. This is left as an exercise.
Hope you are not bored with the above lecture.
P.S. By the way, this is very fast. Even if you have 100 pairs of lines, the code you write will be executed instantly.
My articles and software tools
|
|
|
|
|
Hello,
I would like to change dos prompt caption using C#.
Usually, we kicked bat file using Process.start() or double click, dos prompt caption is "c:\WINNT/system32/cmd.exe".
I would like to change another title.
If you have some solutions, please tell me.
best regards,
yu-yu
|
|
|
|
|
just use the title command in the bat file
title mytitle
"When the only tool you have is a hammer, a sore thumb you will have."
|
|
|
|
|
Or you could just use the following:
Process.Start("cmd.exe", "/k title Title");
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Great.
My new year's resolution:
1. Refrain from giving stupid answers in the programming forum.
2. If failed to do #1, delete my post as soon as Heath posted his answer.
My articles and software tools
|
|
|
|
|
the vs designer is ok for generating menus but the code gets quite bloaty.
is there either a more compact way to generate menus and their click handlers, or alternatively some slick way of collecting them all in a separate "menus.cs" file?
TIA
________________________________________
Gosh, it would be awful pleas'n, to reason out the reason, for things I can't explain.
Then perhaps I'd deserve ya, and be even worthy of ya..
if I only had a brain!
|
|
|
|
|
I solve this problem using #region directives:
#region Menus
private MenuItem mnuFile;
private MenuItem mnuFileNew;
private MenuItem mnuFileOpen;
private MenuItem mnuFileLine1;
private MenuItem mnuFileSave;
private MenuItem mnuFileSaveAs;
private MenuItem mnuFileLine2;
private MenuItem mnuFileExit;
#endregion
#region Menu events
#region File
private void mnuFileNew_Click(object sender, System.EventArgs e)
{
}
private void mnuFileOpen_Click(object sender, System.EventArgs e)
{
}
private void mnuFileSave_Click(object sender, System.EventArgs e)
{
}
private void mnuFileSaveAs_Click(object sender, System.EventArgs e)
{
}
private void mnuFileExit_Click(object sender, System.EventArgs e)
{
}
#endregion
#endregion
Since you use Visual Studio, this would hide the menu code, and add more structure to your source file.
- Daniël Pelsmaeker
And if your dream is to care for your family, to put food on the table, to provide them with an education and a good home, then maybe suffering through an endless, pointless, boring job will seem to have purpose. And you will realize how even a rock can change the world, simply by remaining obstinately stationary.
-Shog9
|
|
|
|
|
You could just type everything manually. Using the designers isn't magic - they generate code. Instead of using the designer - just type it yourself. Write a class with your menus, instantiate it, and assign that as the menu for your application.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
How is it possible to find a server in a network with dynamic IPs? (A custom server)
|
|
|
|
|
|
Until now, I've just gone on my merry way assuming that the only way to determine whether a time was AM or PM was either to get back a string with .ToShortDateString() and parse it out using Split, or to check to see if the Hours field in the date's TimeOfDay field was greater than 12. I haven't been happy with either answer, but haven't found a better one. What is the "proper" API way of doing this? Or is what I've mentioned all I get?
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Why not just check if DateTime.Hour >= 12 ?
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
I'm an idiot! I recall stepping through the debugger on a recent project and I could have sworn a 1 o'clock appointment record was coming up with an hour value of 1 rather than 13, but sure enough, I just built a simple desktop app to test it again and it came up with 13 on a 1:00 pm. I had just ASSumed that there was someething I was missing to determine meridian. Oh well. Here's to assuming!! Thanks. I appreciate you answering a stupid question.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
Hi, I'm looking through a lot of COM interfaces with a mind to reproduce them in C#, but i'd idealy like a handful that are simple enough to implement without going into complex background structures.
If anyone knows 6 or so objects, i'll have a play with them.
Thanks
Cata
|
|
|
|
|
Look in the Shell Programming section of the Platform SDK. There's TONS of easy and useful interfaces in there that you can use.
Other important often easy ones are like IPersistFile , IPersistStream , and other IPersist* interfaces.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thanks m8
I've downloaded the Windows SDK, but i can't find the shell section.
There appears to be no documentation, although I've found what appears to be the shell section in the following path:
X:\Microsoft SDK\Samples\winui\Shell
I've found a few examples, but there isn't much documentation. Am I in the right place?
Additionaly, how do i access the windows help files associated with the SDK? Are they automaticaly linked to VS.net? Or do i have to tie them in manualy?
Additionaly, .NET can't build C. I'm looking for a microsoft certified C compiler, but they don't have any listed on their site. They are either C++, or .NET.
Do i even need to compile them? Or are they all already present in the windows directory?
Cheers
Cata
|
|
|
|