|
If you look at the documentation, (or even just try it and look at what you get) I think you will see that you get a OnKeyDown event for each key. No, not together. Seperately. One after the other.
Just how did you think e.KeyCode was going to equal two different values? Rewrite your code as
if (e.KeyCode == 1 && e.KeyCode == 2)
and you might get the point?
I am posting this to Coding horrors as a warning to all other students.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Really good answer, thanks Even if you didn't offer any solution
I have never thought that e.KeyCode never could return two or more keyboard inputs 
|
|
|
|
|
So far as I know, you can only use:
"Shift / Ctrl / Alt" + Key
But not Space and Up.
|
|
|
|
|
Yes, I know how Shift/Alt/Ctrl + key.
Back to my question, is there any solution for this at all?
|
|
|
|
|
Because you get a separate event for each key pressed if you want to do custom combinations you need to set your own flags for each key of interest in the key down events and clear them in the key up events.
It is a truth universally acknowledged that a zombie in possession of brains must be in want of more brains.
-- Pride and Prejudice and Zombies
|
|
|
|
|
I figured out a solution based on your answer, thanks!
|
|
|
|
|
can anyone please tell me how to get the printer Job status using PJL command.I used the following command
sendString = String.Format("\x1B%-12345X@PJL \r\n @PJL JOB NAME = \"MyJob\" START = 1 \r\n PJL USTATUS JOB = ON \r\n @PJL INFO USTATUS \r\n @PJL ENTER LANGUAGE = PCL \r\n\x1B E . . . . PCL Job . . . . \x1B E\x1B%-12345X@PJL \r\n @PJL EOJ NAME = \"MyJob\" \r\n \x1B%-12345X\r\n");
Is this command appropriate?How to create JOB name or ID ?here I am giving my own name(MYJob)and job id shud b generated by printer or we have to give it while printing the document?Please help me to know the printer job status.
|
|
|
|
|
hello all,
is there any idea to do that, pls? i only found out drag and drop file to listbox control.
thanks in advance,
kyi kyi
|
|
|
|
|
Hello
I have to build an application which checks if a document is still availiable on a specific path. This application is used on our intranet. Html sites are no problem but how can I check, if a file on a Share exits? e.g. \\Server01\share$\test.doc
It should be possible to differ if the share is unavailiable or if the user hasn't enough rights to access.
Are there any opensource solutions for this problem or with which method can i solve my problem?
thanks for your help!
best reagrds
succo
|
|
|
|
|
Would System.IO.File.Exists() not do the job?
You could then catch any FileNotFound or AccessDenied exceptions?
|
|
|
|
|
Look into storing and using the UNC path[^].
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I am an experienced developer in c# and working on LOB application from last 7 Years, I have some issues in understanding usage of Lambda expression in programming.
As far as i understand it is useful in case of
1) Working with LINQ (Grouping, Select,Where etc..)
2) We can pass Lambda expression to any function as argument, so it can be used in place of delegate or anonymous function or normal function.
3)We can create generic lambda function which takes any datatype variable as argument and can return any datatype
e.g.
MyFirstLambdaFunc((val1,val2) => val1+val2)
public R MyFirstLambdaFunc<R,T>(Func<T,T,R> lambdaexpression,T x,T y)
{
R Result = lambdaexpression(x, y);
return Result;
}
4)Coding can be compact
Now the question is that
1) Are there any other advantages ?
2) When we pass lambda expression as function we can pass only single line operation?
3) Can anybody have some case study or some practical example document ?
Thanks in Advance
Harish Bhattbhatt
|
|
|
|
|
Greetings, welcome to CodeProject
About your interest in Lambda, Click Here[^]
|
|
|
|
|
|
using vs2003.
Its a data entry application, having some fields and buttons.
In this, I am using combobox control, getting data from DB in DataTable obj dt, then setting the datasource property of Combobox to this dt.
there is New button, when user clicks on it, it simply clears all fields text, their DataBindings, for combox also i am using it as
cbBox.DataBinding.Clear();
cbBox.Text = "";
then there Save button which saves data to DB, on this Save click event i am checking data entered, like
if(cbBox.Text =="")
{
}
But here is problem, after clicking new button, all fields got clear, cbBox text goes blank. But if user did not enter any data in cbBox then it retains the previous text(text before clicking New button)
a) why this? how to rectify.
b)Related to DataRow?
when we load some data from DB, we fill it in Datatable obj first.
then iterate thru all rows.
SQL = "Select * from Data where ID = 23";
execute this SQL against DB.
assume ID is primary key,
now only single row returned,
How to get this DataRow without filling it in Datatable?
regards,
modified on Thursday, June 25, 2009 7:35 AM
|
|
|
|
|
Hum Dum wrote: a) why this? how to rectify.
Ans: Check whether your have written your code in
if(!page.ispostback)
{
//check whether your code lies here....
}
Hum Dum wrote: SQL = "Select name from Data where ID = 23";
execute this SQL against DB.
assume ID is primary key,
now only single row returned,
How to get this DataRow without filling it in Datatable?
string con = ConfigurationManager.AppSettings["connect"];
SqlConnection conn = new SqlConnection(con);
conn.Open();
SqlCommand cmd = new SqlCommand("select name from Data where ID=23", conn);
object obj = cmd.ExecuteScalar();
conn.Close();
string name = obj.ToString();
|
|
|
|
|
padmanabhan N wrote: if(!page.ispostback)
If i am not wrong then ispostback is for web application, mine is window......??
padmanabhan N wrote: object obj = cmd.ExecuteScalar();
It will return only 1st most column, not the entire row?
But i want whole row content.
sorry for wrong query
I want to write
SQL = "Select * from Data where ID= 23"
|
|
|
|
|
i am developing a software like microsoft outlook express.i done mail sending but i can not receive mail....
please help me its urgent
|
|
|
|
|
|
thanks a lot for reply i am dunning the source
|
|
|
|
|
But There is an error.
Error:Value cannot be null.
Parameter name: item
And its point to :Status.Items.Add(RdStrm.ReadLine());
Thank you
|
|
|
|
|
how can i change the contrast of the image at the same time changing brightness. my brightness can change. its working fine i want to change the contrast at the same time....can i use this method too ???
Bitmap image = new Bitmap("d:\\14.jpg");
Bitmap bm = new Bitmap(image, 350, 300);
System.Drawing.Bitmap TempBitmap = bm;
float FinalValue = 0.5f;
System.Drawing.Bitmap NewBitmap = new System.Drawing.Bitmap(TempBitmap.Width, TempBitmap.Height);
System.Drawing.Graphics NewGraphics = System.Drawing.Graphics.FromImage(NewBitmap);
float[][] FloatColorMatrix ={
new float[] {1, 0, 0, 0, 0},
new float[] {0, 1, 0, 0, 0},
new float[] {0, 0, 1, 0, 0},
new float[] {0, 0, 0, 1, 0},
new float[] {FinalValue, FinalValue, FinalValue, 1, 1}
};
System.Drawing.Imaging.ColorMatrix NewColorMatrix = new System.Drawing.Imaging.ColorMatrix(FloatColorMatrix);
System.Drawing.Imaging.ImageAttributes Attributes = new System.Drawing.Imaging.ImageAttributes();
Attributes.SetColorMatrix(NewColorMatrix);
NewGraphics.DrawImage(TempBitmap, new System.Drawing.Rectangle(0, 0, TempBitmap.Width, TempBitmap.Height), 0, 0, TempBitmap.Width, TempBitmap.Height, System.Drawing.GraphicsUnit.Pixel, Attributes);
Attributes.Dispose();
NewGraphics.Dispose();
picDecode.Image = NewBitmap;
A S E L A
|
|
|
|
|
You can add the contrast and brightness matrices, I guess, or you can apply one, then the other.
Christian Graus
Driven to the arms of OSX by Vista.
"! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums.
I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
|
|
|
|
|
i could do it....but i got a big problem. as i told im doing a QR barcode reader by using webcam. my web cam pictures are too dark so i have to process image before i send it to decode. some times after process i code decode.but when the envirentmant change it couldn't decode. that mean when change brightness and contrast in enviranmetn i couldn't decode. is there any solution....may be auto brightness and contrast detect or some thing else....???
A S E L A
|
|
|
|
|
Hi,
I think you want a non-linear transformation, ideally something that maps all colors to either black or white. Maybe ImageAttributes.SetThreshold could help you out, provided you give it a good value, at best it would depend on the average brightness of your image,
Luc Pattyn [Forum Guidelines] [My Articles]
DISCLAIMER: this message may have been modified by others; it may no longer reflect what I intended, and may contain bad advice; use at your own risk and with extreme care.
|
|
|
|
|