CandymanJP said:
hey, i'm working on the POS register application that you designed. i can't get the buttons to display the number that was pressed. might have something to do with the part where i have to make button one send a 1 and so on.. right where you said.. "I trust you are smart enough to have btn1 send a '1', btn2' send a '2' and so on. For now, fill in code for buttons...
Rather than make a public comment on someone's profile page for something like this, a private message works a lot better so there can be two way communication.
UPDATE: Being a new user you can't yet use the PM system. Sorry. So about the only thing I can do is post your question and answer here. Hopefully that will clear up issues for anyone else that goggle's across this thread as well.
Ok, so you're having trouble getting a button to send a character. Maybe you missed the code earlier in the article where we have a method to raise an event.
namespace Keypad.cs
{
public partial class GenericKeypad : UserControl
{
public GenericKeypad()
{
InitializeComponent();
}
#region Events
public event KeyPressEventHandler ButtonPressed;
#endregion Events
#region Methods
public void RaiseButtonPressed(char WhatToSend)
{
KeyPressEventHandler handler = ButtonPressed;
if (handler != null)
{
handler(this, new KeyPressEventArgs(WhatToSend));
}
}
#endregion Methods
}
So when someone clicks the '1' button, you call RaiseButtonPressed with the char '1'. When someone clicks the '2' button, you call RaiseButtonPressed with the char '2' ... and so on.






MultiQuote






|