|
As long as you let the user exit somehow.
Generally it's better to put up a "Are you sure?" dialog.
Other than that... here[^] is a link to a similar question (which a simple search may have found).
And this[^] one.
modified on Tuesday, December 9, 2008 10:58 PM
|
|
|
|
|
It can be done easily by overriding ProcessCmdKey in your form.
protected override bool ProcessCmdKey(ref System.Windows.Forms.Message msg, System.Windows.Forms.Keys keyData)
{
if (msg.Msg == WM_SYSKEYDOWN)
{
switch (keyData)
{
case System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4:
return true;
}
}
return false;
}
If you need to handle the System menu's close button and / or the X buttonas well then have a look at my Movement restricted dialog form[^] article. It handles all these on dialog forms but it can be applied to any form at all.
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn)Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia)
|
|
|
|
|
I`m frustrated! Okay,I have Windows Application in C# which has Excel Embedded in it via WebBrowser. I can`t overwrite this file with the changes I make cause the file is locked. I tried a lot of things, but this seems to be a know issue. I can save the changes I make to the Excel File by using [Cntrl + S]. What I`m tying to do is have the users click a button which in turn does Cntrl + S. I can`t seem to get this working. Here is the code I`m playing with.
[DllImport("User32.DLL")]
public static extern int SendMessage(IntPtr hWnd, UInt32 Msg, Int32 wParam, Int32 lParam);
public const Int32 WM_KEYDOWN = 0x100;
public const Int32 WM_CHAR = 0x102;
public const Int32 WM_KEYUP = 0x101;
public const Int32 SDown = 0x220001;
public const Int32 SUp= 0x0220001; //0xC0220001
public const Int32 CtrlDown = 0x11D0001;
public const Int32 CtrlUp = 0x11D0001; // 0xC11D0001
private void button2_Click(object sender, EventArgs e)
{
SendMessage(this.Handle, WM_KEYDOWN, 0x11, CtrlDown);
SendMessage(this.Handle, WM_KEYDOWN, 0x53, SDown);
SendMessage(this.Handle, WM_CHAR, 0x7, SDown);
SendMessage(this.Handle, WM_KEYUP, 0x53, SUp);
SendMessage(this.Handle, WM_KEYUP, 0x11, CtrlUp);
}
Or is there anyother way to save the file? All replies are greatly appreciated.
|
|
|
|
|
This is a nasty hack. Can you do a saveas and then close the spreadsheet, delete the old file and rename the new one ? Seems like less of a hack to me than sendmessage is.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I tried that too, the web browser locks up the file. Also I can`t save the changes made to the excel file.
|
|
|
|
|
when I open the property dialog for Internet protocol version 4 (TCP/IP) for any connection, there is a advanced button. If I click this advanced button, another dialog will showup. For the IP setting tabs, I can add or remove IP addess to/from this list box.
Now I want to do same thing programatically. Is there any way to do it?
I tried to add IP address to the registry manually, even it does showup this dialog but I am not able to ping this this newly added Ip address from another machine but When I add IP address manually using this dialog box, it works fine.
Is there any way to copy this same functionalities to add IP address to this box.
Any advice or hint will be appreciated greatly.
Thank you.
|
|
|
|
|
Maybe you will find the IP Helper API useful. link[^]
led mike
|
|
|
|
|
when i click X button on form, i need to show dialog YesNoCancel.
how to detect exit event for show dialog?
please give hint or tip to me
thank so much...
|
|
|
|
|
Handle the dialog form's Closing event. You can put up your Yes/No dialog in there.
|
|
|
|
|
Hello
Since month now I'm working with WORLD coordinate to display them on a Picture Box using a Graphics
I was making the ofsetting and scaling (manualy) because I never understand the documentation provided for the TransForm matrix
I hope that some specialist will help me to understand how to set a matrix to display an image having
OfsetX
OfsetY
scaleX
scaleY
And taking care that Y coordinate of an image are inverted from the real world
Thanks for any help
Olivier
|
|
|
|
|
You should take a look at this site[^].
What you're trying to do would result in this 3x3 matrix:
[ scaleX 0 0 ]
[ 0 -scaleY 0 ] [ OffsetX OffsetY 1 ]
Multiplying your (x,y,1) coordinate with this matrix should result in what you're trying to do.
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Thank you Greeeg
Now I have to find out how to set those values in the GDI Matrix
|
|
|
|
|
Thank you Greeed
I've tryed several ways to set a Transformmatrix with GDI but it does't work !
Here is what I'm doing outside the matrix :
X=(X-OfsetX)* Scale
Y=(Y-OfsetY)* Scale
Y=abs(Y-ImageHeight)
It works well
The real problem is the inversion of Y from the "real" world to an Image origin
If I set the Matrix as this
Matrix m=new Matrix();
m.Translate(-offset_Xf, -offset_Yf, MatrixOrder.Append);
m.Scale(scale_f, scale_f, MatrixOrder.Append);
My Y is reversed in the image
And I still do not find to set the matrix properly !
|
|
|
|
|
I'm working on an ASP.Net application accessing couple of database tables from AS400 mainframe server database . In the code there's an SQL Query, which seems very complicated to me, the person who did the actual coding is no more with our firm.
Right now the query is producing some kinda result which is wrong. So can anyone please help me out in finding what's wrong with the SQL query? The SQL query is attached below:
Me.OdbcSelectCommand2.CommandText = "SELECT SAMFILE.STAYP.SCLINT, SAMFILE.STAYP.SADMHH, SAMFILE.STAYP.SADMYY, SAMFILE.STAYP.SADMMM, SAMFILE.STAYP.SBLDG, SAMFILE.STAYP.SADMDD, SAMFILE.STAYP.STRMCD, SAMFILE.STAYP.STRMHH, SAMFILE.STAYP.STRMYY, SAMFILE.STAYP.STRMMM, SAMFILE.STAYP.STRMDD, SAMFILE.CLIENTP.CNAME, SAMFILE.CLIENTP.CRACE1, SAMFILE.CLIENTP.CRACE2, SAMFILE.CLIENTP.CRELIG, SAMFILE.CLIENTP.CSEX, SAMFILE.CLIENTP.CBTHHH, SAMFILE.CLIENTP.CBTHYY, SAMFILE.CLIENTP.CBTHMM, SAMFILE.CLIENTP.CBTHDD, SAMFILE.REFSRP.REFSDS, SAMFILE.STAYP.SMDPM, SAMFILE.STAYP.SREFRL, SAMFILE.STAYP.SADRG1, SAMFILE.STAYP.SADRG2, SAMFILE.RACETP.RACEDS, SAMFILE.RELIGP.RELGDS, SAMFILE.STAYP.SADMAG FROM SAMFILE.REFSRP, SAMFILE.RELIGP, SAMFILE.RACETP, { oj SAMFILE.STAYP LEFT OUTER "JOIN SAMFILE.CLIENTP ON SAMFILE.STAYP.SCLINT = SAMFILE.CLIENTP.""CLNT#""} WHERE SAMFILE.REFSRP.REFSCD = SAMFILE.STAYP.SREFRL AND SAMFILE.RELIGP.RELGCD = SAMFILE.CLIENTP.CRELIG AND SAMFILE.RACETP.RACECD = SAMFILE.CLIENTP.CRACE1" // After some loop conditions, the OdbcSelectCommand2 is used in 4 concatenations like this. OdbcSelectCommand2.CommandText = OdbcSelectCommand2.CommandText & " AND (({ fn CONCAT({ fn CONCAT({ fn CONCAT({ fn CONCAT({ fn CONCAT(digits(SADMHH), digits(SADMYY)) }, '-') }, digits(SADMMM)) }, '-') }, digits(SADMDD)) } <= { d '" & End_date_conv & "' })"OdbcSelectCommand2.CommandText = OdbcSelectCommand2.CommandText & " AND ({ fn CONCAT({ fn CONCAT({ fn CONCAT({ fn CONCAT({ fn CONCAT(digits(STRMHH), digits(STRMYY)) }, '-') }, digits(STRMMM)) }, '-') }, digits(STRMDD)) } >= { d '" & Start_date_conv & "' })"OdbcSelectCommand2.CommandText = OdbcSelectCommand2.CommandText & " OR ({ fn CONCAT({ fn CONCAT({ fn CONCAT({ fn CONCAT({ fn CONCAT(digits(SADMHH), digits(SADMYY)) }, '-') }, digits(SADMMM)) }, '-') }, digits(SADMDD)) } <= { d '" & End_date_conv & "' })"OdbcSelectCommand2.CommandText = OdbcSelectCommand2.CommandText & " AND (SAMFILE.STAYP.STRMCD = 0))" // To get the desired result, one more table is suppossed to be used, i.e MOVESP table, but its a tremendously huge table containing records of more than 30+ years and each id is having multiple records and to get the expected result it should be used in the code as something like this. But everytime I try this, it throws an exception "System.outofmemoryexception". I tried increasing the physical and virtual RAM and even timeout durations too but all in vain. OdbcSelectCommand2.CommandText = OdbcSelectCommand2.CommandText & " AND (SAMFILE.MOVESP.MCODE = 'A'))"
Note:
This query works but it fetches wrong information. In the below query I want to replace the last condition (SAMFILE.STAYP.STRMCD = 0 ) with this new condition (SAMFILE.MOVESP.MCODE = ""A"" ) and I believe this will make it to fetch the right values to display on the crystal report. But whenever I try to include this new code alongwith other necessary changes it shoots up an erorr message. And the other changes which I make are like :
1. Adding a new element by the name "MCODE " in "as400ds2.xsd "
2. Adding [New System.Data.Common.DataColumnMapping("MCODE", "MCODE")] into the OdbcDataAdapter.TableMappings.AddRange section.
Thanking you all in anticipation
|
|
|
|
|
YOu say the query "shoots up an error message". Care to post it? we're not psychics.
|
|
|
|
|
cool down bro........!!!
reg. the erro msg : whn i add this piece of code in the end
of the SQL string (SAMFILE.MOVESP.MCODE = ""A"" ),
the error message is : ERROR [42S22] [IBM][iSeries ACCESS ODBC
Driver][DB2 UDB]SQL0206 - Column A not in specified tables.
and whn I change it to : SAMFILE.MOVESP.MCODE = 'A' ,
it takes a long time to process the webpage and after a prolonged
period of time, shows the "Page cannot be displayed" error message.
|
|
|
|
|
Just fishing here, but is journaling enabled on the AS/400 file?
|
|
|
|
|
|
look dear, if u can put in some valuable comments, pls go ahead, otherwise dont try to rule anybody, u get tht.
|
|
|
|
|
f*** off a**hole
led mike
|
|
|
|
|
Please stop it.
modified on Tuesday, December 9, 2008 3:36 PM
|
|
|
|
|
Nice job changing that old post I linked to. Still I saw it so, f*** off a**hole.
led mike
|
|
|
|
|
very bad Led......i'm surprised who ur employer is...........
|
|
|
|
|
Perhaps, however
Reality Strikes wrote: please have basic manners
you proved you are a giant hypocritical turd with that post given your reply to Graus which you have now deleted in an attempt to hide the truth thereby also proving you are without honor and integrity. So for the last time (today), f*** off a**hole.
led mike
|
|
|
|
|
i dont know wht the heck u r blabbering..........take a day off from u work and relax.........u will feel better........!!!
led mike wrote: So for the last time (today), f*** off a**hole.
why making it the last time, say it over and over..........coz thts wht ur parents taught u..........say it very proudly.........!!!
|
|
|
|
|