|
Hey Guyz
Ive had some troubles with Application.Exit() , I sometimes call it but the application doesnt exit. Ive Rectified this by calling Environment.Exit(0); instead
note that im sending 0 as the exit code, i have NO idea what this is or why its there, nevermiond the implications of it. I tried different numbers aswell and it also worked.
Im scared that this comes back to bite me in the ass once we've shipped so what do you guys think of calling Environment.Exit(0); ?
thanx
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
think BIG and kick ASS
you.suck = (you.passion != Programming)
|
|
|
|
|
HarveySaayman wrote: note that im sending 0 as the exit code, i have NO idea what this is or why its there, nevermiond the implications of it.
Did it not occur to you to check the documentation[^]?
Its basically the exit code passed to the OS.
A simple google search can answer your question on the difference, but in brief your app will need permission to run unmanaged code in order to call Environment.Exit. I would suggest that Application.Exit is the better/safer to use and the reason you're having problems with it is probably to do with some shabby threading code.
|
|
|
|
|
what is this "documentation" thing of which you speak?
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
|
I would have the form call its Close() method.
|
|
|
|
|
Hi,
the exitCode parameter is the value returned to the process that launched your app;
it is the same value good old C/C++ programs could return in their main function.
If you launch from a .bat file you can get its value, and use it to signal a
success/error situation with zero/nonzero.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
A C# program's main can return a value too.
|
|
|
|
|
Hi PIEBALD,
thanks for pointing this out.
int main indeed returns an exitCode, and it will override a possible prior assignment
to Environment.ExitCode
I was not aware of this, basically because I did not need it so far, and Visual Studio
generates a void main for free, not an int one (for "better performance"!?)
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Luc Pattyn wrote: it will override a possible prior assignment to Environment.ExitCode
Then I learned something too.
C/C++ also allow main to be void or int; I always make mine int.
|
|
|
|
|
Hey Guys
I need a way to check if the window handle has been created before i call invoke
im not entirely sure what a window handle is and tried googling the problem. One solution i found was Thread.Sleep(1000) But the pause is too noticable in my book. The Only way i can think of is to wait until the handle is created before i call invoke
any ideas on how i can do this?
Thanx
Harvey Saayman - South Africa
Junior Developer
.Net, C#, SQL
think BIG and kick ASS
you.suck = (you.passion != Programming)
|
|
|
|
|
HarveySaayman,
this.HandleCreated += new EventHandler(OnHandleCreated);
this.HandleDestroyed += new EventHandler(OnHandleDestroyed);
Regards,
Gareth.
|
|
|
|
|
You can use something like this.
public class AvoidWindowHandleErrorForm : Form
{
private bool _hasHandle = false;
public AvoidWindowHandleErrorForm()
{
this.HandleCreated += delegate
{
_hasHandle = true;
};
}
public new void Invoke(Delegate d)
{
if (this._hasHandle)
base.Invoke(d);
else
{
this.HandleCreated += delegate
{
base.Invoke(d);
};
}
}
}
If I remember correctly, there are a couple of ways to force handle creation, though I forgot which ones :s.
Standards are great! Everybody should have one!
|
|
|
|
|
Hello fellow coders.
I'm having a hard time figuring out very easy thing with the datagridview so here is a screen of it in my program:
datagrid
My 2 questions are, I think, easy, but I can't find any solution and Google isnt helping me at all:
- How to get ride of the left column (the one with the cursor that shows the selected rows), or at least, how to resize it to make it a fixed size ?
- How to make column headers clickable? Currently in my program, the columns are not clickable and this is quite a huge issue for sorting things out. That followed with a 2nd question: how to programatically display a sorting glyph to the column header?
Thank you!
|
|
|
|
|
Tony_P wrote: - How to get ride of the left column (the one with the cursor that shows the selected rows), or at least, how to resize it to make it a fixed size ?
set RowHeadersVisible property to false, and to resize it, DGV have a property named RowHeadersWidth
Tony_P wrote: How to make column headers clickable? Currently in my program, the columns are not clickable
what you wanna say ?? default is clickable
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
set RowHeadersVisible property to false, and to resize it, DGV have a property named RowHeadersWidth
Thank you!
what you wanna say ?? default is clickable
Well I'm feeding my datagridview with a SqlCeResultSet (through a BindingSource) and autogeneratecolumns set to true so I guess everything is default but still the column headers are not clickable. They are like standard labels.
SqlCeResultSet rs = functionThatReturnsAResultSet();<br />
this.dataGridView1.AutoGenerateColumns = true;<br />
this.dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;<br />
this.bindingSource1.DataSource = rs;<br />
this.dataGridView1.DataSource = this.bindingSource1;
I confirm column headers are not clickable.
|
|
|
|
|
try this :
DGV.Columns[0].SortMode = DataGridViewColumnSortMode.Automatic;
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Still no difference. I'm investigating on it but I can't find any help. Could this be a problem with SqlCeResultSet or the fact that I have an "ORDER BY" statement in my SQL query giving the ResultSet?
|
|
|
|
|
i think its cause is binding, you have bound the DGV
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
I see. I've tryed to recreate a new DGV and fill it with a simple "SELECT * FROM" query but still got the same results. Is there any way to make the column clickable even though data is bound (so I could handle the "ColumnClick" events) ?
In fact, I've tried to add a HeaderMouseClick event to my DGV and it's handled properly, but still the headers don't act like they're clickable (ie: they act like labels, not buttons).
|
|
|
|
|
dunno , i will suggest you to add rows manually
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
i want to make a remote backup server using C#. so if any body has code examples related to this plz send me.
regards
|
|
|
|
|
Read the first post in the forum titled "how to get an answer to your question", pay attention to item #2
led mike
|
|
|
|
|
hi friends...
In my form contain one richtextbox and one button.. in richtextbox i want to show the contents page by page or some fixed length from rtf file while clicking the button...How can i do this...
|
|
|
|
|
This question is asked one or more times a week. There is an article here on code project that covers working with RichTextBox, go find it.
led mike
|
|
|
|
|
i am tried but i can't found correct document...You have any link please send me..
|
|
|
|