G
Guest
The ListView.KeyPress event is exposed in the
...NET Compact Framework, but maybe I am using it incorrectly. A complete
program is included below: I never get the MessageBox from
listView_KeyPress. This approach works on the .NET Framework. What am I
missing?
using System.Drawing;
using System.Windows.Forms;
namespace SmartDeviceApplication6
{
public class Form1 : Form
{
private ListView listView;
public Form1()
{
listView = new ListView();
listView.Location = new Point(10 , 10);
ListViewItem lvi = new ListViewItem( "Item" );
listView.Items.Add( lvi );
Controls.Add( listView );
Text = "Form1";
listView.KeyPress += new KeyPressEventHandler( listView_KeyPress
);
}
private void listView_KeyPress( object sender, KeyPressEventArgs e )
{
MessageBox.Show( "Key pressed" );
}
static void Main()
{
Application.Run( new Form1() );
}
}
}
Rogerio
...NET Compact Framework, but maybe I am using it incorrectly. A complete
program is included below: I never get the MessageBox from
listView_KeyPress. This approach works on the .NET Framework. What am I
missing?
using System.Drawing;
using System.Windows.Forms;
namespace SmartDeviceApplication6
{
public class Form1 : Form
{
private ListView listView;
public Form1()
{
listView = new ListView();
listView.Location = new Point(10 , 10);
ListViewItem lvi = new ListViewItem( "Item" );
listView.Items.Add( lvi );
Controls.Add( listView );
Text = "Form1";
listView.KeyPress += new KeyPressEventHandler( listView_KeyPress
);
}
private void listView_KeyPress( object sender, KeyPressEventArgs e )
{
MessageBox.Show( "Key pressed" );
}
static void Main()
{
Application.Run( new Form1() );
}
}
}
Rogerio