|
Exactly. But the OPs complaint is that the DateTime object still contains time.
|
|
|
|
|
sachees123 wrote: But i still didnt get my solution...
You seem to want the moon on a plate.
You want a string parsed to a DateTime, you do not want the time element. Your solution, and the solution everyone else uses, is to simply ignore the time part. If you are doing date calculations then normalise it by setting the time part to midnight (e.g. myDateTimeObject = myDateTimeObject.Date )
|
|
|
|
|
How can a query compare my date with that of ms access date???
|
|
|
|
|
Use a parameterised query.
With Access you use a question mark to denote where a parameter goes. Then you add the values in the Parameters collection in the same order in which the question marks appear in your query.
cmd.CommandText = "SELECT * FROM MyTable WHERE SomeDateColumn = ?";
cmd.Parameters.AddWithValue("?", myDateTimeObject);
|
|
|
|
|
well thanks Colin Angus Mackay and HO for your friendly support.
Things work with the
DateTime dt = DateTime.ParseExact(textBox1.Text.ToString(), "MM/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture);
Thanks a ton
Will come again with new problem...
c ya again
|
|
|
|
|
|
Hi,
Why dont you try out using regular expressions and return only the date... I think that might solve your problem...
|
|
|
|
|
normally i run application1 by opening the solution and pressing F5.
Is it possible to create a dummy application2, then include application1's DLL
by adding reference to it and execute application1 from dummy application2?
|
|
|
|
|
Is application1 all in a DLL? There is no EXE component to it?
You can include a reference to an assembly in your project and create classes and call methods from the referenced assembly.
If application1 really is an EXE you can launch it using the Process class.
|
|
|
|
|
hi colin,
thanks for the response. based on your reply, i searched in internet
on "process" and i could see examples of how to execute applications
like notepad, windows and other *.bat applications..
suppose my application1 is called "InputDLL", is the following the correct
method to implement ... while trying at my training centre, i got permission denied abend.
<<<br mode="hold" />System.Diagnostics.Process process = new Process();
process.StartInfo.FileName = "InputDLL";
process.Start();
>>
Thanks,
NetQuestions
|
|
|
|
|
I try to write a program to get link inside a web page. I got source page of web page and get all link inside it,but there had a link don't appear in source page (link download a file mp3). But I can see it with IDM program by select "Download all link with IDM". This is the site I try to do it :"http://say.expressivo.com/eric/bye_mother
I want to get link to download file MP3 in this site (the link don't appear in source page). How can I do it ?
Thank for help
|
|
|
|
|
hi, i apologize for asking this simple question
but i should ask it because i am not familiar with the terminology to search in the internet
i want to have a child form, and i know how to do it
but i don't want the parent form be accessible when the child exists
please tell me what can i do?
here is the code i used for my child form
Form2 myChildForm = new From2();
myChildForm.MdiParent = this;
myChildForm.show();
|
|
|
|
|
Are you talking about modal and non-modal/modeless forms? Form.Show() will create a modal dialog. Form.ShowDialog() will create a modeless dialog. Link[^]
I am confused as to why you are setting MdiParent - I doubt you can make the parent unusable when an MDI child is open. This should work for you:
Form2 myChildForm = new From2();
myChildForm.ShowDialog();
|
|
|
|
|
No, the ShowDialog will create a mode dialog, but the Show will create a non-mode dialog. The mode dialog means that others form can not be operated.
|
|
|
|
|
thank you for your good answer just exactly what i wanted
and you learned me the terminology
but in real you told me the terms modal, and non-modal exactly vice versa
Show() will create a non-modal and ShowDialog() will create a modal
if you are in shake just check the modal dialog in the wikipedia
thanks a lot
|
|
|
|
|
Name Description
ShowDialog()()() Shows the form as a modal dialog box with the currently active window set as its owner.
ShowDialog(IWin32Window) Shows the form as a modal dialog box with the specified owner.
From the MSDN website.
http://msdn.microsoft.com/en-us/library/system.windows.forms.form.showdialog.aspx
|
|
|
|
|
|
Hey, glad to help you man
Yeah, I guess I got my answer mixed up though.
|
|
|
|
|
i created an application using Visual C# connecting to Linux server and using MySQL as its database. here's my test application.. (guide link)
http://camilord.kagayan.com/2009/04/13/visual-c-connecting-to-mysql-remotely/
but my problem is how can I resolve the lag connection to remote server? because every time I connect to the server, it took few seconds to respond. kinda laggy. any ideas to solve this problem?
|
|
|
|
|
I wanted to close a previous form after calling the next form. How do i do that?
I have many form in my application. When i exit the application using the following code all the forms are closed one by one. Instead i want to close the previous form after calling the next form in order to avoid the closing of all the forms after exit. Please help.
DialogResult result = MessageBox.Show("Do you want to exit?", "Exit-Window", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1);
if (result == DialogResult.OK)
Application.Exit();
I have tried with the following code but the application exits automatically.
The code is written on the command button on Form1.
private void button1_Click(object sender, EventArgs e)
{
Form2 frm2 = new Form2();
frm2.Show();
this.Close();
}
|
|
|
|
|
The reason why the application exits automatically is that the entry point for it is located in a class usually called Program.cs that has the following code:
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
The last line (Application.Run(new Form1())), starts a message loop that ends as soon as the main form is closed (new Form1()), what causes the end of the application.
To prevent the application from exiting I've found two possible solutions based on your original idea:
1. The first one is not to close the main form but to hide it:
private void button1_Click(object sender, EventArgs e)
{
Form2 frm2 = new Form2();
frm2.Show();
this.Hide();
}
2. The second is to invoke the Application.Run() overload that doesn't take a Form as parameter but an ApplicationContext. This object (that always exist), implements an overridable method called OnMainFormClosed() that is responsible of shutting down the application when the main form is closed. To prevent this from happening, you can derive a new class from it that substitutes the original method by another that does nothing:
//New class.
class ApplicationContextOwn : ApplicationContext {
//Overriden method does nothing
protected override void OnMainFormClosed(object sender, EventArgs e) {
}
}
static class Program {
public static ApplicationContext ac = new ApplicationContext();
///
/// The main entry point for the application.
///
[STAThread]
static void Main() {
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
//The application is started using an instance of the new class.
ApplicationContext ac = new ApplicationContextNew();
ac.MainForm = new Form1();
Application.Run(ac);
}
}
Hope this helps.
|
|
|
|
|
The application is closing because you're calling the main form that was started by the application.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
hi all
This is to read the tag line by line.
using System.Xml;
...
...
...
XmlTextReader reader = new XmlTextReader ("reader.xml");
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element: // The node is an element.
Console.Write("<" + reader.Name);
Console.WriteLine(">");
break;
case XmlNodeType.Text: //Display the text in each element.
Console.WriteLine (reader.Value);
break;
case XmlNodeType.EndElement: //Display the end of the element.
Console.Write("</" + reader.Name);
Console.WriteLine(">");
break;
}
}
Console.ReadLine();
How do i read the specific tag
if i just want to read all the tag that have this < big > tag?
thank you
modified on Monday, April 13, 2009 3:36 AM
|
|
|
|
|
use an XmlDocument[^] and the SelectNodes[^] method to search for specific nodes. This[^] article has a nice cheat sheet of the XPath syntax for searching for nodes.
|
|
|
|
|
I am developing an application in which I need to compare two pieces of VB code. I am searching a component which I can embed and do? Can any one help in this regard? Or any codes foe developing such a tool.
Regards
Surya
|
|
|
|