DateTimePicker control problem

L

lateshpatel

Hi,

I have added reference to OpenNetCF.Windows.Forms.dll in my smartdevice
application. When I try to initialize DateTimePicker control using
following lines, it throws "An unhandled exception of type
'System.MissingMethodException' occurred in
OpenNETCF.Windows.Forms.dll" exception....Don't know why? Am I missing
something basic?

private OpenNETCF.Windows.Forms.DateTimePicker dtPicker;

-- Following line gives an error.....
dtPicker = new OpenNETCF.Windows.Forms.DateTimePicker();

this.Controls.Add(dtPicker);

I'm using OpenNet SDF 1.4 with .Net 1.1

Thanks.
 
L

lateshpatel

Smartphone 2003 ...

Following is my code....

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using OpenNETCF.Windows.Forms;

namespace SmartTest
{
/// <summary>
/// Summary description for Form2.
/// </summary>
public class Form2 : System.Windows.Forms.Form
{
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private OpenNETCF.Windows.Forms.DateTimePicker dtAlarmTime;

public Form2()
{
//
// 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.dtAlarmTime = new OpenNETCF.Windows.Forms.DateTimePicker();
this.Controls.Add(this.dtAlarmTime);

this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
//
// mainMenu1
//
this.mainMenu1.MenuItems.Add(this.menuItem1);
//
// menuItem1
//
this.menuItem1.Text = "Close";
this.menuItem1.Click += new
System.EventHandler(this.menuItem1_Click);
//
// Form2
//
this.Menu = this.mainMenu1;
this.Text = "Form2";
this.Load += new System.EventHandler(this.Form2_Load);

// Date time picker
//this.dtAlarmTime.CustomFormat = "HH:mm";
this.dtAlarmTime.Format =
OpenNETCF.Windows.Forms.DateTimePickerFormat.Long;
this.dtAlarmTime.Location = new System.Drawing.Point(8, 168);
this.dtAlarmTime.ShowUpDown = true;
this.dtAlarmTime.Size = new System.Drawing.Size(96, 25);
this.dtAlarmTime.Value = new System.DateTime(2005, 7, 11, 16, 9, 0,
0);
this.dtAlarmTime.GotFocus += new
System.EventHandler(this.dtAlarmTime_GotFocus);

}
#endregion

private void dtAlarmTime_GotFocus(object sender, System.EventArgs e)
{
// Do nothing
}

private void menuItem1_Click(object sender, System.EventArgs e)
{
// Do nothing
}

private void Form2_Load(object sender, System.EventArgs e)
{

}
}
}
 
L

lateshpatel

Smartphone 2003 ..

Following is my code.....Thanks for your help.....


using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using OpenNETCF.Windows.Forms;

namespace SmartTest
{
/// <summary>
/// Summary description for Form2.
/// </summary>
public class Form2 : System.Windows.Forms.Form
{
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private OpenNETCF.Windows.Forms.DateTimePicker dtAlarmTime;

public Form2()
{
//
// 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.dtAlarmTime = new OpenNETCF.Windows.Forms.DateTimePicker();
this.Controls.Add(this.dtAlarmTime);

this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
//
// mainMenu1
//
this.mainMenu1.MenuItems.Add(this.menuItem1);
//
// menuItem1
//
this.menuItem1.Text = "Close";
this.menuItem1.Click += new
System.EventHandler(this.menuItem1_Click);
//
// Form2
//
this.Menu = this.mainMenu1;
this.Text = "Form2";
this.Load += new System.EventHandler(this.Form2_Load);

// Date time picker
//this.dtAlarmTime.CustomFormat = "HH:mm";
this.dtAlarmTime.Format =
OpenNETCF.Windows.Forms.DateTimePickerFormat.Long;
this.dtAlarmTime.Location = new System.Drawing.Point(8, 168);
this.dtAlarmTime.ShowUpDown = true;
this.dtAlarmTime.Size = new System.Drawing.Size(96, 25);
this.dtAlarmTime.Value = new System.DateTime(2005, 7, 11, 16, 9, 0,
0);
this.dtAlarmTime.GotFocus += new
System.EventHandler(this.dtAlarmTime_GotFocus);

}
#endregion

private void dtAlarmTime_GotFocus(object sender, System.EventArgs e)
{
// Do nothing
}

private void menuItem1_Click(object sender, System.EventArgs e)
{
// Do nothing
}

private void Form2_Load(object sender, System.EventArgs e)
{

}
}
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top