473,382 Members | 1,437 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

VB6 Button.Value = true/false - how to do this in c#?

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

Nov 15 '05 #1
4 5192
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

Nov 15 '05 #2
I will give it a try. Thanks a lot.

Regards,
Chua Wen Ching :p
Nov 15 '05 #3
Chua Wen Ching wrote:
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?


How about using the .Tag property?

--
Arild Fines

http://ankhsvn.tigris.org
A Visual Studio .NET Addin for the Subversion version control system.
Nov 15 '05 #4
Dude, from the looks of things here it might be best for you to go out and
buy a book on C#.

"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

Nov 15 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Nick250 | last post by:
I have a simple app that I created for our Real Estate office using Access 2000 and it is working fine except for on thing. I need to keep the close button hidden from the users. No problem...
3
by: Zürcher See | last post by:
Someone has implemented a Datagrid Button for the Windows.Form?
2
by: techfuzz | last post by:
I scoured this group and others looking for the best way to disable a button after the first click to prevent multiple submissions, but never did find anything that worked like they said it would. ...
5
by: Girish | last post by:
I have TWO submit buttons of type IMAGE on my asp form. This renders as <input type="image">. I need to be able to eble the ENTER button for both buttons. Yes, I know that for the input type...
4
by: John Boy | last post by:
Hi, Can anyone help. This is really doing my nut in. 3 years ASP exp. and now doing .DOT which is a step in the wrong direction. Basically I am left with the code of a guy who has left. When I...
1
by: Stephen D Cook | last post by:
What I am trying to do is have a set of option buttons which are required to click one. If the person doesn't click any before insert, they get an error. If they do click one, it inserts into the...
8
by: Richard Maher | last post by:
Hi, I am in a mouseup event for button A and I'd like to disable=false button B before starting some work. Is there anyway that an event for button B can then fire before my event processing for...
5
by: DonnaDarko | last post by:
I need help again if possible! I want to offer two options for a future user of my program. In Option1(0), the variable resSat must be known and is then used to calculate the variable Mass_BLOB....
0
by: DJOuk | last post by:
Posted this on Asp.Net, seems to be a hard problem, I still can't work it out I have a edit button, this works fine, until I add the code that prevents the edit button from being seen by users who...
1
by: ahilar12 | last post by:
Hi all, I am new to php,my question is that in this following code i am retrieving many rows from the database which is working good.i want to delete a particular row(s) which is checked(checkbox)...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.