|
Hi, I need a Listbox with only Left Key Event. All other keys should be ignored.
I've Inherited the Listbox Control and overridden its OnKeyUp(...) (and similar) Methods and provided them with
following Implementation
protected override void OnKeyUp(System.Windows.Forms.KeyEventArgs e)
{
if( e.KeyCode == Keys.Left )
{
// My Code
}
else
; // Do Nothing
//No Call to base.OnKeyUp(e) Made Anywhere in this method
}
Still My Custom Listbox Implements its Default Key behaviour and handles all the keys (Up, Down, PageUp, etc...)
Please Advice
Thanks...
|
|
|
|
|
Hello,
You have to override OnKeyDown where you check the KeyCode, and also OnKeyPress.
Not calling the base. method will not work in this cases, you will have to set the e.Handled property to true.
public class SpecialListBox : System.Windows.Forms.ListBox
{
public SpecialListBox()
{
}
protected override void OnKeyDown(KeyEventArgs e)
{
if(e.KeyCode != Keys.Left)
{
e.Handled = true;
}
base.OnKeyDown (e);
}
protected override void OnKeyPress(KeyPressEventArgs e)
{
e.Handled = true;
base.OnKeyPress (e);
}
}
Hope it helps!
All the best,
Martin
|
|
|
|
|
Thanks for the Way, Martin...
Actually I wanted to Shift the Focus to some other control whenever the user pressed Left on My CustomListBox. So all I did was...
protected override void OnKeyDown(System.Windows.Forms.KeyEventArgs e)
{
if( e.KeyCode == Keys.Left )
{
MyControl.Focus(); // Do What I Want to For Left Key Press
e.Handled = true;
return;
}
else // for Other Keys do your Default Handling
base.OnKeyUp(e);
}
protected override void OnKeyPress(System.Windows.Forms.KeyPressEventArgs e)
{
e.Handled = true;
base.OnKeyPress (e);
}
|
|
|
|
|
Hello,
Glad I could help!
protected override void OnKeyDown(System.Windows.Forms.KeyEventArgs e)
{
if( e.KeyCode == Keys.Left )
{
MyControl.Focus(); // Do What I Want to For Left Key Press
e.Handled = true;
return; <= not neccessary
}
else // for Other Keys do your Default Handling <= not neccessary
base.OnKeyUp(e);
}
You are wellcome!
All the best,
Martin
|
|
|
|
|
Thanks Martin.
Well<= not necessarycome
Your Last Line
|
|
|
|
|
Dear All,
Please guide me about imposing Expiry date to MS Office files (.doc, .docx, .xls, .xlsx, .ppt, .pptx, InfoPath) using C#, such that if the file has expiry date today, it should not open tomorrow.
I know, we can do it if the IRM client is installed on client machine, but to avoid burden on the user we are told to do it through code.
Regards
Sachin
|
|
|
|
|
There's no way to implement that kind of functionality. The filesystem would have to support it and, of course, it doesn't. You'd have to write your own file system extension (not in C#) to do this.
|
|
|
|
|
Thanks for your reply.
But I think its possible, as its already done by one vendor of our client, since its their IP, we do not have access to the source code. That DLL imposes all IRM rights that includes expiry date too.
Regards
Sachin
|
|
|
|
|
One of two things can do this. Either the application supports it, or the file system supports it.
For the file system, you'd have to write an extension to the file system.
For an application, you'd have to write some kind of Add-In for that application that replaces the app's load/save functionality.
You can't just "throw in" an expiration date into the document properties and expect that to work on every instance of the application. For instance, throwing an expiration date into a Word document doesn't do anything unless that copy of Word has this extension installed. BUT!! What's to stop the user from opening the document on a copy of Word that DOESN'T have the extension installed?? NOTHING!! The document must be encrypted somehow to get around this kind of functionality limitation. You need to stop other copies of Word from opening up the document.
As for how to replace the load/save functionality, I have no idea.
|
|
|
|
|
Thanks for the reply Dave,
Well, I got some clue from MOSS ECM Starter Kit, where they have given some information about custom IRM protector.
If I get anything concrete out of it, will definitely share.
If any one has already done some work on it, please do share.
Regards
Sachin
|
|
|
|
|
hello,
I am in a trouble. I have done an application with Oracle and C#. I have created the setup.exe also. The application will work in oracle client installed systems. Is there any way to run the application without installing Oracle Client?
Can anyone knows the answer, please kindly help me....
Anez.A
|
|
|
|
|
I think that you can add the required files (*.dll or etc) including oracle client while creating the setup file.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Thank you Michael...
But, i have done that method also. Still its not working.
First time, the error got is Missing OraOps9.dll.
I've added OraOps9.dll into the setup file. Still not working. The error shows, the specified path is incorrect. Cannot find Such file or directory...
Anyway, thanks a lot for the reply to my question...
Anez.A
|
|
|
|
|
which version of oracle are you using?
I hope you can add the dlls only if you are using oracle 10g.
The best option according to me is to use some web service or remoting feature .Use that webservice to connect with the oracle server. You need to install the client only in webserver.
|
|
|
|
|
I'm using Oracle 8i and Oracle 9i.
ok jith.
thank you for your information.
Anez.A
|
|
|
|
|
It may be too late now, have you taken a look at ODP.NET?
http://www.oracle.com/technology/tech/windows/odpnet/index.html
|
|
|
|
|
Hi everyone,
Im using c# asp.net 2.0. In a dataset im having one column value as either 0 or 1,if the row value is 1 means the checkbox should be checked and its 0 means the checkbox should be unchecked in the gridview,im having the checkbox column as a template column.im having one checkbox column.How should i achieve this..
regards
Kanna..
|
|
|
|
|
Put one more label in this checkbox column. the DataField of this label should be mapped to the actual field from database.
In Item_DataBound() event of GridView, you can check whether the value is 0 or 1. then, find the checked box control and check or uncheck based on the value..
Eg: Item_DataBound Event
Label lbl = (Label)e.FindControl("lblValue");<br />
CheckedBox chk = (CheckedBox)e.FindControl("chkCheckedBox");<br />
chk = (lbl.Text == "1") ?? true:false;<br />
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
just bind data as other columns. But the Column u want to be in checkbox should be of datatype 'Bit' in database.
|
|
|
|
|
how to populate data in a datadridview through programs
shashank
|
|
|
|
|
<br />
string strSQLconnection = "Data Source=dbServer;Initial Catalog=testDB;Integrated Security=True";<br />
SqlConnection sqlConnection = new SqlConnection(strSQLconnection);<br />
SqlCommand sqlCommand = new SqlCommand("select * from table1", sqlConnection);<br />
sqlConnection.Open();<br />
<br />
SqlDataReader reader = sqlCommand.ExecuteReader();<br />
GridView1.DataSource = reader;<br />
GridView1.DataBind();
Ref: How to populate DataGridView, GridView with SQL statement in C#
More .....[^]
Hope it helps..
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
shashankshekhar wrote: how to populate data in a datadridview through programs
By using Google[^]
Cheers,
Vıkram.
Be yourself, no matter what they say.
- Sting, Englishman in New York.
|
|
|
|
|
Hai All,
I am having my first work in generating hipaa edi streams, validating edi streams using XML schema!Could anyone please tell me some ideas to do this? This is my first work, so i have to do more careful, It will be really thankful,if you help me! please help me!
i have to finish this work in C#.net! Please help me!
|
|
|
|
|
Hello
I have to search a string "AssemblyVersion" and if i get this string i have to comment it, and also add comment in front of this string ,
if this string is already commented then it will not comment again...
I have to search this string in Assemblyinfo.cs file and this file is in different project.
How do i Solve this problem?
If anyone know that how to search the string and comment it then plz tell me as soon as
Thanks in Advance..
-- modified at 0:30 Thursday 30th August, 2007
|
|
|
|
|
Hi,
Open the file usual but give right the path and search with regex.
hope this help.
|
|
|
|