|
Don't do data access directly in your form; split it out to a separate class.
|
|
|
|
|
ShowInTaskBar is only a property of WinForm. So, how do I get a console app to not appear in the taskbar?
Thanks!
Marc
|
|
|
|
|
Changing the project output type to Windows Application will remove the console window. This would only be of use if you don't need access to any of the standard handles, i.e. you're not using the Console class.
Alan.
|
|
|
|
|
Are you suggesting that a Windows Application can't access the Console class?
|
|
|
|
|
I was envisaging a program that required no user interaction, e.g. a simple utility that could be run as a scheduled task. In this situation the form-less windows application is perfect as it is completely invisible to the user and won't steal focus from the foreground task. If there is no console window then most of the Console class is rendered useless. The Read and Write methods fail gracefully, presumably because they are wired to null streams, but other methods that attempt to access the 'window' or keyboard, e.g. Console.Title, Console.ReadKey throw an IOException.
Console.CapsLock is still good!
Alan.
|
|
|
|
|
And Beep; don't forget Beep.
|
|
|
|
|
I don't know, so this is not an answer..
But, you can get the hWnd of the console window (or so I've heard..) by setting the title to something randomish (to avoid accidental duplicates) and then doing FindWindow on that. I'm not sure where to go from there, but there is probably a WinAPI call / message / SetStyle hack for it, right?
|
|
|
|
|
I'm reviewing for an interview, and the following question is on my list:
"What event occurs before a control is rendered to the user?"
I'm uncertain if the answer that's sought is PreInit or Postback. Please advise. Thanks.
Draykko
=======================
Every experience in life is a lesson to be learned
A. Stevens
B.S., Computer Science
|
|
|
|
|
The user purchases a computer and powers it up.
|
|
|
|
|
OnPaint
Harvey Saayman - South Africa
Software Developer
.Net, C#, SQL
you.suck = (you.Occupation == jobTitles.Programmer && you.Passion != Programming)
1000100 1101111 1100101 1110011 100000 1110100 1101000 1101001 1110011 100000 1101101 1100101 1100001 1101110 100000 1101001 1101101 100000 1100001 100000 1100111 1100101 1100101 1101011 111111
|
|
|
|
|
I would like to build a Imperial to Metric converter program like the many I have seen on the web. I would like to use this project as a way to better understand C# object orentation, building classes etc. In particular the "front-end" engineering and design aspects.
I have read many books on C# programming but I'm still not feeling like I am concepually putting my programs together efficiently.
Can some one point me into a good source of information on this subject.
tia
rafone
Statistics are like bikini's...
What they reveal is astonishing ...
But what they hide is vital ...
|
|
|
|
|
I am studying a TreeView implementation.
The TreeView uses classes which encapsulate certain controls such as textbox, checkbox etc.
Each item class inherits from Component (not Control).
Generally speaking, why would you inherit from Component like this?
|
|
|
|
|
Hi,
I would inherit from Component, not from Control, to get objects that can be inserted and configured with Visual Studio Designer, without them being Controls, i.e. actual GUI parts. Some examples are:
System.IO.Ports.SerialPort
System.Windows.Forms.Timer
System.Timers.Timer
see MSDN[^]
For GUI parts I would derive specialized Controls from their typical original (e.g. a special TextBox from TextBox) and composite Controls from UserControl.
|
|
|
|
|
When I'm a bad developer. Fortunately, as a good developer, I don't derive from either those; I implement appropriate interfaces instead.
There are many places within .net where inheritance was used when interface implementation would be more appropriate.
|
|
|
|
|
Hi I am struggeling with a print problem since a while.
I want to print the content of a Panel thats sits in a form. The panel has a dynamic number of labels in it.
I have tried with both crystal reports and the Visual Studio PrintForm powerpack but it is not what I am looking for.
Has someone got a best practice or any hints for me. Completing my first c# course at Uni so I am quite new at it.
Thanks in advance
|
|
|
|
|
Here[^] is one way of doing this.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Hi.
can u tell me how can install Crystal Report When i am installing my project to another computer(With Install Shield)?like .Net FramWork.
When i install my project to user's computer this message is shown.
Could not Load or find assembly 'CrystalDecisions.Windows.Forms,Version=10.5.3700,Culture=neutral....'
But i did add this refrence to my project.
Thank u.
CanI
|
|
|
|
|
Is that file present at the same location in the user computer as you have set in your code?
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
I can't find that file in my computer too!!!
I have installed Crystall Report in user's system but it isn't working yet.
(I added that Assembly in my C# program And Built it.(Release it) and in my install Shield project i added all files from Release Folder).
Did i do any mistake?or should i do anything more?
Thank u.
CanI
|
|
|
|
|
The error message says what you need to so. That file is not there on the computer. So update your setup such that the file is copied to the user computers while installation.
50-50-90 rule: Anytime I have a 50-50 chance of getting something right, there's a 90% probability I'll get it wrong...!!
|
|
|
|
|
Now i have form1 and form2
datetimepicker1 and datetimepicker2 is in form1
i want to use datetimepicker1 and datetimepicker2 on form2 from form1,set datetimepicker1'modifiers and datetimepicker2'MOdifiers to public on form1, i wrote my code on form1 like this string from, to;
from = this.dateTimePicker1.Value.ToString("yyyy-MM-dd");
to = this.dateTimePicker2.Value.ToString("yyyy-MM-dd");
it can work very well
then wrote my code on form2 like this
Form1 frm=new Form1();
string from, to;
from = frm.dateTimePicker1.Value.ToString("yyyy-MM-dd");
to = frm.dateTimePicker2.Value.ToString("yyyy-MM-dd");
when i run my code ,from=2010-01-09,to=2010-01-09 on form2
but when i select dateTimePicker1=2010-01-05, dateTimePicker2=2010-01-09 on form1,
then run my code ,it shows from=2010-01-05,to=2010-01-09 on form1,but it also shows from=2010-01-09,to=2010-01-09 on form2,it do not change anymore on form2,i think it may be read from the most beginning.
i want to get the changed dateTimePicker.Value,how could i do
thanks everyone?
|
|
|
|
|
Can you post the actual code, rather than your synopsis? I have some thoughts about what may be happenning, but I don't want to lead you astray by guessing. Copy and paste the code for both forms in your reply, then highlight all of it and click the
code block tag above to preserve your formatting.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|
|
miss YY wrote: set datetimepicker1 and datetimepicker2 modifiers to public on form1
Not necessary and not a good idea
miss YY wrote: on form2 like this
Form1 frm = new Form1();
This is the clue! This is a new instance of Form1 (i.e. not the same one as you are viewing) so the DateTimePicker s are not the same ones and therefore have different values.
Where is form2 created - in Form1? If so, keep a reference in Form1 to the new Form2 . In Form2 , create properties or methods to receive the DateTime s, and set them from Form1 when they change using the reference you already have.
Dave
BTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
miss YY wrote: Form1 frm=new Form1();
string from, to;
from = frm.dateTimePicker1.Value.ToString("yyyy-MM-dd");
to = frm.dateTimePicker2.Value.ToString("yyyy-MM-dd");
Since you haven't shown the form, the user hasn't had a chance to change the values. "new" does exactly that: creates a new instance of Form1. If you have an existing instance of Form1 that the user has allready selected the to and from dates on, you need to access that instead.
All those who believe in psycho kinesis, raise my hand.
|
|
|
|
|
Create a static class that holds the DateTime objects, and simply refer to them from both forms.
.45 ACP - because shooting twice is just silly ----- "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." - J. Jystad, 2001
|
|
|
|