M
Mark Irvine
Hi,
I am trying to get the input panel to work with my app, but each time I try
an exception is thrown (no useful info included in the exception.). However
whenever I try to run the code on
http://samples.gotdotnet.com/quickstart/CompactFramework/doc/inputpanel.aspx
or the code included for chapter 4 of the .net compact framework core
reference (ms press), everything works fine. I have looked at the code
many, many time but just can't see what is causing the problem. My code is
below:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using Microsoft.WindowsCE.Forms;
namespace Nihco.Mobile
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class frmLogon : System.Windows.Forms.Form
{
public System.Windows.Forms.TextBox txtUserName;
private System.Windows.Forms.Label lblPassword;
private System.Windows.Forms.TextBox txtPassword;
private System.Windows.Forms.Button btnLogon;
private System.Windows.Forms.Button btnCancel;
private Microsoft.WindowsCE.Forms.InputPanel inputPanel1;
private System.Windows.Forms.Label lblUserName;
public frmLogon()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.txtUserName = new System.Windows.Forms.TextBox();
this.lblUserName = new System.Windows.Forms.Label();
this.lblPassword = new System.Windows.Forms.Label();
this.txtPassword = new System.Windows.Forms.TextBox();
this.btnLogon = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.inputPanel1 = new Microsoft.WindowsCE.Forms.InputPanel();
//
// txtUserName
//
this.txtUserName.Location = new System.Drawing.Point(88, 8);
this.txtUserName.Text = "";
this.txtUserName.LostFocus += new
System.EventHandler(this.txtUserName_LostFocus);
this.txtUserName.GotFocus += new
System.EventHandler(this.txtUserName_GotFocus);
//
// lblUserName
//
this.lblUserName.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F,
System.Drawing.FontStyle.Bold);
this.lblUserName.Location = new System.Drawing.Point(8, 8);
this.lblUserName.Size = new System.Drawing.Size(70, 20);
this.lblUserName.Text = "Username:";
//
// lblPassword
//
this.lblPassword.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F,
System.Drawing.FontStyle.Bold);
this.lblPassword.Location = new System.Drawing.Point(8, 40);
this.lblPassword.Size = new System.Drawing.Size(70, 20);
this.lblPassword.Text = "Password:";
//
// txtPassword
//
this.txtPassword.Location = new System.Drawing.Point(88, 40);
this.txtPassword.PasswordChar = '*';
this.txtPassword.Text = "";
this.txtPassword.LostFocus += new
System.EventHandler(this.txtPassword_LostFocus);
this.txtPassword.GotFocus += new
System.EventHandler(this.txtPassword_GotFocus);
//
// btnLogon
//
this.btnLogon.Location = new System.Drawing.Point(8, 96);
this.btnLogon.Text = "Logon";
this.btnLogon.Click += new System.EventHandler(this.btnLogon_Click);
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(16, 128);
this.btnCancel.Text = "Cancel";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// inputPanel1
//
this.inputPanel1.EnabledChanged += new
System.EventHandler(this.inputPanel1_EnabledChanged);
//
// frmLogon
//
this.ClientSize = new System.Drawing.Size(216, 104);
this.ControlBox = false;
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnLogon);
this.Controls.Add(this.txtPassword);
this.Controls.Add(this.lblPassword);
this.Controls.Add(this.lblUserName);
this.Controls.Add(this.txtUserName);
this.Text = "Logon";
this.Load += new System.EventHandler(this.frmLogon_Load);
}
#endregion
private void txtUserName_GotFocus(object sender, System.EventArgs e)
{
inputPanel1.Enabled = true;
}
private void txtUserName_LostFocus(object sender, System.EventArgs e)
{
inputPanel1.Enabled = false;
}
private void txtPassword_GotFocus(object sender, System.EventArgs e)
{
inputPanel1.Enabled = true;
}
private void txtPassword_LostFocus(object sender, System.EventArgs e)
{
inputPanel1.Enabled = false;
}
private void btnLogon_Click(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.OK;
}
private void btnCancel_Click(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
private void frmLogon_Load(object sender, System.EventArgs e)
{
}
private void inputPanel1_EnabledChanged(object sender, System.EventArgs e)
{
}
}
}
Can anyone help?
Mark
I am trying to get the input panel to work with my app, but each time I try
an exception is thrown (no useful info included in the exception.). However
whenever I try to run the code on
http://samples.gotdotnet.com/quickstart/CompactFramework/doc/inputpanel.aspx
or the code included for chapter 4 of the .net compact framework core
reference (ms press), everything works fine. I have looked at the code
many, many time but just can't see what is causing the problem. My code is
below:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using Microsoft.WindowsCE.Forms;
namespace Nihco.Mobile
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class frmLogon : System.Windows.Forms.Form
{
public System.Windows.Forms.TextBox txtUserName;
private System.Windows.Forms.Label lblPassword;
private System.Windows.Forms.TextBox txtPassword;
private System.Windows.Forms.Button btnLogon;
private System.Windows.Forms.Button btnCancel;
private Microsoft.WindowsCE.Forms.InputPanel inputPanel1;
private System.Windows.Forms.Label lblUserName;
public frmLogon()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.txtUserName = new System.Windows.Forms.TextBox();
this.lblUserName = new System.Windows.Forms.Label();
this.lblPassword = new System.Windows.Forms.Label();
this.txtPassword = new System.Windows.Forms.TextBox();
this.btnLogon = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.inputPanel1 = new Microsoft.WindowsCE.Forms.InputPanel();
//
// txtUserName
//
this.txtUserName.Location = new System.Drawing.Point(88, 8);
this.txtUserName.Text = "";
this.txtUserName.LostFocus += new
System.EventHandler(this.txtUserName_LostFocus);
this.txtUserName.GotFocus += new
System.EventHandler(this.txtUserName_GotFocus);
//
// lblUserName
//
this.lblUserName.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F,
System.Drawing.FontStyle.Bold);
this.lblUserName.Location = new System.Drawing.Point(8, 8);
this.lblUserName.Size = new System.Drawing.Size(70, 20);
this.lblUserName.Text = "Username:";
//
// lblPassword
//
this.lblPassword.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F,
System.Drawing.FontStyle.Bold);
this.lblPassword.Location = new System.Drawing.Point(8, 40);
this.lblPassword.Size = new System.Drawing.Size(70, 20);
this.lblPassword.Text = "Password:";
//
// txtPassword
//
this.txtPassword.Location = new System.Drawing.Point(88, 40);
this.txtPassword.PasswordChar = '*';
this.txtPassword.Text = "";
this.txtPassword.LostFocus += new
System.EventHandler(this.txtPassword_LostFocus);
this.txtPassword.GotFocus += new
System.EventHandler(this.txtPassword_GotFocus);
//
// btnLogon
//
this.btnLogon.Location = new System.Drawing.Point(8, 96);
this.btnLogon.Text = "Logon";
this.btnLogon.Click += new System.EventHandler(this.btnLogon_Click);
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(16, 128);
this.btnCancel.Text = "Cancel";
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// inputPanel1
//
this.inputPanel1.EnabledChanged += new
System.EventHandler(this.inputPanel1_EnabledChanged);
//
// frmLogon
//
this.ClientSize = new System.Drawing.Size(216, 104);
this.ControlBox = false;
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnLogon);
this.Controls.Add(this.txtPassword);
this.Controls.Add(this.lblPassword);
this.Controls.Add(this.lblUserName);
this.Controls.Add(this.txtUserName);
this.Text = "Logon";
this.Load += new System.EventHandler(this.frmLogon_Load);
}
#endregion
private void txtUserName_GotFocus(object sender, System.EventArgs e)
{
inputPanel1.Enabled = true;
}
private void txtUserName_LostFocus(object sender, System.EventArgs e)
{
inputPanel1.Enabled = false;
}
private void txtPassword_GotFocus(object sender, System.EventArgs e)
{
inputPanel1.Enabled = true;
}
private void txtPassword_LostFocus(object sender, System.EventArgs e)
{
inputPanel1.Enabled = false;
}
private void btnLogon_Click(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.OK;
}
private void btnCancel_Click(object sender, System.EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
private void frmLogon_Load(object sender, System.EventArgs e)
{
}
private void inputPanel1_EnabledChanged(object sender, System.EventArgs e)
{
}
}
}
Can anyone help?
Mark