Piece of cake. Use the following code and create a new WinForms control
with it. This class inherits from the System.Windows.Forms.Button control
and adds a Value property. You can then use this new "Value Button" on your
forms rather than the standard button and store a value in it. Feel free to
modify the "imports" as needed - I removed some of the properties you
shouldn't need (I currently generate this buttons at runtime in a POS
application and add product ID's to the value members so I can determine
what product was clicked and then retrieve price information from the
database.)
Brian Patterson
NOTE: Remove upper case characters from email address to email me directly.
----------------------------------<snip>------------------------------------
-
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
namespace ValueButton
{
public class ValueButton : System.Windows.Forms.Button
{
private int m_Value;
private System.ComponentModel.Container components = null;
public ValueButton()
{
InitializeComponent();
}
protected override void Dispose( bool disposing )
{
if( disposing )
{
if( components != null )
components.Dispose();
}
base.Dispose( disposing );
}
public int Value
{
get
{
return m_Value;
}
set
{
m_Value=value;
}
}
#region Component 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()
{
//
// ValueButton
//
this.Name = "ValueButton";
}
#endregion
}
}
----------------------------------<snip>------------------------------------
-
"Chua Wen Ching" <cw*@cwc.com> wrote in message
news:03****************************@phx.gbl...
Hi there,
button1.Value = true/false 'in vb6
how to code that in c#? Any help please?
I cannot find the value properly for buttons in c#. I not
sure what to replace value for buttons?
Thanks.
Regards,
Chua Wen Ching