all groups > dotnet windows forms > november 2007 >
You're in the

dotnet windows forms

group:

Ibuttoncontrol example


Ibuttoncontrol example Luc
11/13/2007 5:52:15 AM
dotnet windows forms:
Hi,

can somebody help me out with a (working ) example of the Ibuttoncontrol on
f.i. a textbox, so if the users uses the enter key on the textbox, an event
(msgbox) is showed

Thx!!
--
Best regards
Re: Ibuttoncontrol example Alexander Vasilevsky
11/16/2007 3:10:11 AM
Please try code below

using System;
using System.Windows.Forms;

namespace CmdShell
{
class TextBoxIButtonControl : TextBox, IButtonControl
{
protected override void OnKeyPress(KeyPressEventArgs e)
{
if (e.KeyChar == '\n')
{
e.Handled = true;
PerformClick();
}
base.OnKeyPress(e);
}

#region IButtonControl Members

public DialogResult DialogResult
{
get
{
throw new Exception("The method or operation is not
implemented.");
}
set
{
throw new Exception("The method or operation is not
implemented.");
}
}

public void NotifyDefault(bool value)
{
//throw new Exception("The method or operation is not
implemented.");
}

public void PerformClick()
{
MessageBox.Show("Test");
//throw new Exception("The method or operation is not
implemented.");
}

#endregion
}
}


http://www.alvas.net - Audio tools for C# and VB.Net developers


"Luc" <Luc@discussions.microsoft.com> ÓÏÏÂÝÉÌ/ÓÏÏÂÝÉÌÁ × ÎÏ×ÏÓÔÑÈ ÓÌÅÄÕÀÝÅÅ:
news:00AC182A-503F-430C-9F49-4AC609F36E2E@microsoft.com...
[quoted text, click to view]

Re: Ibuttoncontrol example Luc
11/16/2007 4:52:00 AM
Dear Alexander,

Thx for your help so far, but........ since I'm a VB programmmer, do you
have the code in VB?
--
Best regards
Luc

[quoted text, click to view]
AddThis Social Bookmark Button