Jul
I’m struggling with a problem in Visual Basic. Currently, I’m programming a User-Operated Directory Assistance Program as a class project. I’ve several important buttons which displays the texts: 2, 3, 4, 5, 6, 7, 8, & 9 on a textbox when clicked.. THE MAIN PROBLEM BEHIND THIS IS THAT I CANNOT CONCATENATE THE NUMBERS ON THE LABEL. IT ONLY SHOWS ONE NUMBER IN THE LABEL AND NOT MORE THAN ONE.
For example, the 2 ABC button displays 2 on the label. 3 DEF button displays 3 on the label. 4 GHI button displays 4 on the label. 5 JKL button displays 5 on the label. 6 MNO button displays 6 on the label. 7 PQRS button displays 7 on the label. 8 TUV button displays 8 on the label. 9 WXYZ button displays 9 on the label.
So, can you tell me of a way or give me a sample source code that allows me to display a number such as 7664 on the label below.
Thank you.
Your contribution would be greatly appreciated.
- Nathe
Answer:
I got you
i'll assume that you’re using visual basic .NET (although the same words applies to visual basic 6
you’ve to make your code ADD the next numbers to the current not to override it .. like this
lblScreen.Text = lblScreen.Text btnNumber7.Text
now if lblScreen.Text has 5 displayed and you btnNumber7 is pressed, lblScreen will only add 7 to the current number on it so it will result in 57. Note that the word 'add' here means string concatenation not algebraic addition, note also that i assume that btnNumber7 is a name of a button that has “7″ as its caption.
Book Mark it-> del.icio.us | Reddit | Slashdot | Digg | Facebook | Technorati | Google | StumbleUpon | Window Live | Tailrank | Furl | Netscape | Yahoo | BlinkList