|
This is a C# forum so the answer from here would be
DateTime.Now.ToString("dddd, MMMM d, yyyy")
If this is different from what works in excel, you may need to ask in a different forum.
Brent
|
|
|
|
|
You can format DateTime strings in .NET any way you want. This little article[^] of mine contains the necessary links to MSDN, and more.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Or maybe use the long date time option.
|
|
|
|
|
If you mean that you want it formatted by Excel then you have to add the formatting to the cell that holds the datetime value.
The best things in life are not things.
|
|
|
|
|
Thanks for the help. My solution kept unfortunately having issues using the above formats within my excel report however when I placed a comma in front of the date, it worked fine.
String reportDate = "'" + DateTime.Now.ToString("dddd, MMMM d, yyyy");
Thanks.
|
|
|
|
|
In Form2 Properties I set - IsMDIContainer = True. And Form3 is MdiChild with Formborderstyle=None. MdiPaarent Form2 is having Toolstrip Hence while I dock its possible to see from all mdichild forms. And my problem is when I click the close button, it's also closing the MDIParent. But I need to close only mdichild... for that I tried as like Vb.Net2008 style by the following codes placed in MDIParent Form2, Its not working. Any right directions ...
private void toolStripButton1_Click(object sender, EventArgs e)
{
Form3 NwMdiChild2 = new Form3;
NwMdiChild2.MdiParent = this;
NwMdiChild2.Dock = System.Windows.Forms.DockStyle.Fill;
NwMdiChild2.Show();
}
private void Form2_FormClosing(object sender, System.Windows.Forms.FormClosingEventArgs e) {
Form[] MdiChildForms = this.MdiChildren;
int kkk1 = MdiChildForms.Length;
int x = 0;
for (x = 0; x <= MdiChildForms.Length - 1; x += 1)
{
if (MdiChildForms[x].Name == "Form1")
{ kkk1 = kkk1 - 1;
}
MdiChildForms[x].Close();
}
if (kkk1 > 0)
{
e.Cancel = true;
}
else
{
e.Cancel = false;
Application.Exit();
}
}
Any Right Directions for Me?
Thanks For Reply
|
|
|
|
|
So you want this...
The user clicks the close button on the MdiParent and
if there are child forms open, close them all but leave the parent open
else close the parent & application
?
If so, this will do it. I have renamed the forms/controls to sensible names so the code is easier to follow.
using System;
using System.Windows.Forms;
namespace MdiApplicationTest
{
public partial class FormParent : Form
{
public FormParent()
{
InitializeComponent();
}
private void toolStripButtonNewChild_Click(object sender, EventArgs e)
{
FormChild child = new FormChild();
child.MdiParent = this;
child.Dock = DockStyle.Fill;
child.Show();
}
private void FormParent_FormClosing(object sender, FormClosingEventArgs e)
{
if (MdiChildren.Length > 0)
{
foreach (Form form in MdiChildren)
form.Close();
e.Cancel = true;
}
}
}
}
|
|
|
|
|
Hi Dave,
Thousands of thanks to your kindness...Because I remember when I start Vb.Net you are the one teach to me lot of things.
Just I started C# VS 2010.
But here the problem project startup is
Program.cs
And same code I put in my MDIcontainer its not fired. I checked by messagebox also. I don't know how to detect..
Is it because of startup program ?
Can you pls. check it in C# VS2010?
Thanks Again
|
|
|
|
|
I'm not sure how you're hooking your stuff together.
Here[^] is my solution zipped - see if you can work out how I've done it by examining it.
|
|
|
|
|
Thanks...
It helpmed me lot...
Thanks Again
|
|
|
|
|
Hello Everybody,
I have a variable of property. Now i want to know that how to apply this to Control.
Like :
PropertyInfo Control_Baccolor ;
Now i want to apply this in control:
Button1.Backcolor = ???????
Pls help me how can it possible.
If you can think then I Can.
|
|
|
|
|
|
First, You can assign only System.Drawing.Color to Button1.Backcolor.
Second, you need to create new derived button class or Create custom control, to be able to assign your own properties, to your needs. (Custom Control Example[^]
♫ 99 little bugs in the code,
99 bugs in the code
We fix a bug, compile it again
101 little bugs in the code ♫
|
|
|
|
|
Hello,
I am working on application which use Apple iPod. We check weather device is connected using WMI query.
We are using NUnit for unit testing. Every-time we need to check function which searches device we need to plug-in iPod. But just for unit testing, having iPod not seems to be feasible.
Can we add virtual device, so we can detect it using WMI, without having device physically present.
Thanks in Advance.
Happy Programming.
|
|
|
|
|
Only if you get out the device driver kit and write a device yourself.
It would be FAR easier and quicker to plug in any old iPod.
|
|
|
|
|
Thanks Dave. I think you are right.
|
|
|
|
|
Agreed.
I have encountered situations like this where devs have hacked in bypass code to manipulate results. This, of course, invalidates the test both in principle and validity, so please, please DO NOT DO THAT as a work-around.
[Edit]Sorry, Dave, I replied to your answer and not the OP's comment.[/Edit]
I wasn't, now I am, then I won't be anymore.
|
|
|
|
|
Depends on what you are testing.
Obviously writing a pseudo driver is an ideal situation since it not only lets you test against something real but also allows you to simulate errors which might not be possible with a real device.
If you are mainly concerned about testing your code rather than the actual interface layer then you can, carefully, insert a layer that handles the ONLY the API. That layer is implemeted with interfaces (C# type). That allows you to replace them in your unit tests with suitable pseudo code.
|
|
|
|
|
I'm having a problem with a web service in my C# code. I've consumed the web service by adding a web reference and all is good, the reference is consumed correctly I'm getting all my proxy types flow through etc. etc.
When I run a method on the service, however, the returned object is null and no exceptions are thrown:
MethodResponse response = service.Method(methodRequest);
I'm running Fiddler in the background (HTTPS decryption is turned off, even though I'm simply running on HTTP) and I'm getting a legitimate XML response back - it maps perfectly to my response types. I've added some code where I can manually copy the XML response from Fiddler into the code, use an XmlDeserializer, and it works just fine.
I have noticed one thing, though. The request I send has an XML declaration at the beginning of it, whereas the response does not. If I set up Fiddler's auto-responder with the legit response and add an XML declaration to it, I get an exception:
There is an error in XML document (120, 15).
Unexpected end of file while parsing Name has occurred. Line 120, position 15.
That line and position are a bit of a red-herring, as they don't point to anything useful in particular (not even the EOF), and as I said before, the XML is valid. Also, there is no Name element in the XML at all, so I'm assuming it means that it's trying to parse a tag name (which one it doesn't say), not finding the end of it for whatever reason and then passing the EOF.
Any ideas as to what's going on or where I should look next?
Typical n-tiered architecture:
DB <-> Junk(0) <-> ... <-> Junk(n-1) <-> Pretty
|
|
|
|
|
Hi,
i have a set of directive(in listbox) in my application, which contain certain condition..
i need to add this condition from the response which i got in the form of xml and want to change the condition for those directive whose value is changed by the user from frontend application and for those which is unchanged i need to add the condition from the response which i got already in the form of xml..
could u tell me how to do it...
this is my code...
Directive DADirective = new Directive();
Directive[] daDirArray = new Directive[oDirective.Length];
for (int j = 0; j < oDirective.Length; j++)
{
DADirective = new Directive();
DADirective.DirectiveName = oDirective[j].DirectiveName;
DADirective.DirectiveDescription = oDirective[j].DirectiveDescription;
DADirective.Priority = oDirective[j].Priority;
DADirective.Default = oDirective[j].Default;
daDirArray[j] = DADirective;
}
DAData.Directive = daDirArray;
List<SetValueType> SetValueTypeList = new List<SetValueType>();
GetValueTypeCondition(gValueTypeCondition, SetValueTypeList);
daDirArray[selectedindex].SetValueType = SetValueTypeList.FirstOrDefault();
List<Condition> Conditions = new List<Condition>();
List<Group> GroupList = new List<Group>();
getCondition(gCondition, Conditions, GroupList);
int intcount = Conditions.Count;
if (intcount == 1)
{
if (Conditions[0].Field.FieldID != "")
{
daDirArray[selectedindex].Condition = Conditions.ToArray();
for (int i = 0; i < intcount; i++)
daDirArray[selectedindex].Condition[i].LogicalOperator = strLogicalOpt;
}
}
else
{
daDirArray[DirectiveIndex].Condition = Conditions.ToArray();
for (int i = 0; i < intcount; i++)
daDirArray[selectedindex].Condition[i].LogicalOperator = strLogicalOpt;
}
daDirArray[DirectiveIndex].Group = GroupList.ToArray();
string strRequest = GenerateXMLForDerivedAttibute(gdar);
}
|
|
|
|
|
Hi,
I have asked a question regarding convesion of List to DataTable.
Here is the link of question.
Conversion of List to DataTable
Please answer on this question.
Thanks in advance.
Regards
AR
|
|
|
|
|
1. Cross-posting is considered rude. Pick one place to ask your question and stay there unless some senior member tells you otherwise.
2. You already have two answers, essentially the same, with 3 links between them. Why do you think you will get anything different here? (Remember Einstein's definition of insanity - doing the same thing over and over and expecting a different result.)
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
So can you please help me for the same on either place?
|
|
|
|
|
The answers you got are valid. There is no way to do this without iterating through the List because there is no conversion between a List and a DataTable. Even if there was, interanlly, it would be iterating over the List anyway.
|
|
|
|
|