|
Compare it to DateTime.Today().
Bob
Ashfield Consultants Ltd
|
|
|
|
|
You can use DateTime.Now to retrieve current date and time. DateTimePicker has a Value property so you can compare these values.
|
|
|
|
|
if(dateTimePicker1.Value>DateTime.Now)
{
MessageBox.Show("Greater");
}
|
|
|
|
|
if( DateTime.Compare(DateTime.Now, dateTimePicker1.Value) <=0)
{
}
|
|
|
|
|
XP64
VS2008
Compiling app for .Net 3.5
I've written some code to put my app in the system try but it's not working.
In my form, I've added a notifyIcon, a contextMenu, and an icon, and connected them all together (I added the components through the IDE's UI instead of manually typing everything in). I also have the following event handlers in the form:
private void NormalizeForm()
{
if (this.WindowState == FormWindowState.Minimized)
{
this.Visible = true;
this.WindowState = FormWindowState.Normal;
}
this.Activate();
this.notifyIcon.Visible = false;
}
private void MainForm_Load(object sender, EventArgs e)
{
this.ShowInTaskbar = false;
this.Visible = false;
this.WindowState = FormWindowState.Minimized;
this.notifyIcon.Visible = true;
}
private void restoreToolStripMenuItem_Click(object sender, EventArgs e)
{
NormalizeForm();
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
private void notifyIcon_DoubleClick(object sender, EventArgs e)
{
NormalizeForm();
}
Where you see this.Visible = ... , I also tried this.Show() and this.Hide() .
When the app starts, there is nothing in the task bar (as expected), the form isn't on the desktop (as expected), but the icon is NOT in the system tray either.
What am I missing?
"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
|
|
|
|
|
Sorry, I haven't got a good answer for you, but I have a guess.
Firstly, your code works fine for me. (XP[x86], VS2008,.net3.5).
My guess is that the systray is probably a 64 bit app. You can't mix 32 bit and 64 bit processes, so if your .net app is a 32 bit app, then it won't be able to communicate with the systray.
Try changing your build settings to directly target x64.
(By default, .net assemblies are language agnostic, meaning they run as x64 on 64bit systems and x86 on 32 bit systems. So possibly the systray is a 32 bit app, in which case, change your settings to directly target x86)
Does this solve anything?
Simon
|
|
|
|
|
No change.
I did get warnings about some of the .Net assemblies targeting a different processor...
BTW, I also tried running the app inside a XP-32 VM, and it didn't work there either.
"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
|
|
|
|
|
John Simmons / outlaw programmer wrote: I also tried running the app inside a XP-32 VM, and it didn't work there either.
It's obviously not that then.
This is what I did
1) Created new winforms project
2) opened form and pasted your code in
3) Added a notifyicon to the form.
4) Changed your code match the name of my notify icon member.
5) Used the ide to point the form_load event and the notifyicon_doubleclick event at the appropriate methods.
6) Selected icon (using IDE, not by code). It added it to the forms resources.
7) Run - works fine (Also works fine when run outside of VS)
I did originally miss out step 6, and it didn't work. But I doubt that is your problem - maybe double check though. Consider checking icon file format size/res etc (mine's 16x16 32bit 96 dpi)
Simon
|
|
|
|
|
Yep. I did all of that, too.
"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
|
|
|
|
|
1.Make sure that NotifyIcon's is set.
2.Check if similar application works on your system. E.g: Window Tabifier[^]
3. Instead of this.notifyIcon.Visible= true; try setting this from the designer.
|
|
|
|
|
Giorgi Dalakishvili wrote: 1.Make sure that NotifyIcon's is set.
What do you mean by making sure it's set? It's on the form, and there's no exception when the app starts, so I assume it's instantiated correctly. Remember, the notifyIcon control was added in the UI, so all of it's initialization is in Designer.cs.
Giorgi Dalakishvili wrote: Instead of this.notifyIcon.Visible= true; try setting this from the designer.
It's set to true in the designer (and that is the default setting).
"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
|
|
|
|
|
Sorry I meant that NotifyIcon's Icon is set
|
|
|
|
|
I'm pretty sure it's set, but I'll have to wait til I get home to see. (I knew I should brought that code to work with me.)
"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
|
|
|
|
|
Well, I tried creating another app here at work, and now that I see it, I don't remember setting the icon for the notifyIcon control. Why it doesn't use the currently specified icon for the app I don't know (but I think it should be default).
Anyway, I'm probably not setting the notifyIcon icon.
"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
|
|
|
|
|
That has happen several times with me too
|
|
|
|
|
Hi,
I want to display some data in crystal report but I am very new to Crystal Reports.
I want to display some data which is not directly available in database but i have to cook from database.
Where can i write all logic or queries to get correct data?
To explain in detail: let say we i have a column "colA" in data base which has the data 1.0, 1.1, 1.2, 1.3, 2.0, 2.1, 2.2, 2.3.. etc.
I want to display data in column of report as
Row1: MeanOf(1.0, 1.1, 1.2,1.3)
Row2: MeanOf(2.0, 2.1, 2.2, 2.3)
.
.
I am using Table Adapter and Data table.
I don't know where to store the intermediate dataset and further write the logic for cooking the required data?
I ll be greatly thankful for any kind of help.
|
|
|
|
|
Make formula field then show this field in detail section.
|
|
|
|
|
Hi,
i really dont understand what you are asking but i assume that you want to display data (varchar,int,image,etc) from the database to crystal reports, right? OK.
- Add a report and a dataset to your solution
- design the dataset to fit 100% the store_procedure you are triggering, meaning if you have "select first_name 'FN',last_name 'LN' ..." them datatable fields as to be named FN and LN, and have same type!!!
- select the dataset as your datasource, and them drag fields to the report
- after that is easy, keep doing like it was a datagridview
DataGridView_Report.DataSource = dt;
CrystalReport_ConstructorStandings rpt = new CrystalReport_ConstructorStandings();
rpt.SetDataSource(dt);
CrystalReportViewer_Report.ReportSource = rpt;
Only beware of the image formats that are not allowed in crystal reports
(Can´t help you more, but, if you want to ask something related to this go my profile)
nelsonpaixao@yahoo.com.br
trying to help & get help
|
|
|
|
|
hello,
i need help me please, i make a object treeview mix combobox, i explain. i search how catch the childnode's location to aligne the combobox.
|
|
|
|
|
Hi,
I have created an array like this:
string[] arrNames = new string[6];
arrNames[0] = "x";
arrNames[1] = "c";
arrNames[2] = "v";
arrNames[3] = "b";
arrNames[4] = "n";
arrNames[5] = "m";
Without using a for loop, how can I check if my string i.e. strMyString = "b"
is in one of the array list ?
Is there something like:
if (arrNames[].indexOf("b") > 0)
{
string sFound = "found a match";
}
else
{
string sNotFound = "No match";
}
Thanks
|
|
|
|
|
Why don't you use MSDN or Google to is if there is a method called IndexOf() and if there is then which classes have it?
|
|
|
|
|
arkiboys wrote: Without using a for loop, how can I check if my string i.e. strMyString = "b"
is in one of the array list ?
Strictly speaking, you can't with an array, but you can simulate what you're trying to achieve using LINQ.
string[] arrNames = new string[6];
arrNames[0] = "x";
arrNames[1] = "c";
arrNames[2] = "v";
arrNames[3] = "b";
arrNames[4] = "n";
arrNames[5] = "m";
bool isFound = (from p in arrNames
where p == "b"
select true).SingleOrDefault();
|
|
|
|
|
Pete O'Hanlon wrote: Strictly speaking, you can't with an array
Im pretty sure you can, as mentioned just below.
|
|
|
|
|
I was carefully using the term "strictly" because the operation uses the class Array, and is not a method on the array itself. Pedantic, I know, but I'm nothing if not pedantic.
|
|
|
|
|
The actual string array does not have an IndexOf method, but the Array class has a static (and generic) IndexOf method.
string[] foo = new string[] { "a", "b", "c" };
int index = Array.IndexOf<string>(foo,"b");
|
|
|
|