|
Programming and Assembly Language Please read this Topic's rules!! |
![]() |
| LinkBack | Thread Tools | Rate Thread |
| ||||
How about a simple chat program. That should keep you busy ![]() And when you're done with that, go for Uno! ![]()
__________________ "And, most of all, remember this descendant of David who beat the hell out of death." -from the book "Six Hours One Friday" by Max Lucado "You have to go outside the sequence of engines, into the world of men, to find the real originator of the rocket. Is it not equally reasonable to look outside nature for the real Originator of the natural order? -C.S. Lewis Director of JavaScript section of the Allied Sites Support Team, web designer and programmer for DaOCPlace, and co-web designer and programmer for AOA Files Avatar by Epox Tech ![]() <>< I Believe-Do You? |
| ||||
Quote:
![]() LOL This page might help you with some tutorials. You might want to make something like a simple calculator. Get to know basic VB code, properties ,options and stuff. (i don't know how much you know already but...) I'd say learn program structures and stuff first, then its all going to be easy, even if stealing... err, borrowing code from other programs ![]() Good Luck! ![]()
__________________ !!!!Leafs are still #1!!!! ![]() |
| ||||
I wrote a calculator last night. It was fairly easy except the damn KeyPress command doesn't work for me. How do I make it react to every keypress? I attached the program, and heres the source. I started VB sunday so it's not bad progress. I had to censor the source, I forgot why I added the S*** variant, I think because I couldn't have a single = a string, so the variant was like the transition step. Dim sin1 As Single Dim ***** As Variant Dim *****1 As Variant Dim sin2 As Single Dim sinAnswr As Single Dim byt As Byte Rem To make calc work with keypad Private Sub KeyPress(KeyAscii As Integer) Select Case KeyAscii Case 49: lbl1 = lbl1 + "1" Case 50: lbl1 = lbl1 + "2" Case 51: lbl1 = lbl1 + "3" Case 52: lbl1 = lbl1 + "4" Case 53: lbl1 = lbl1 + "5" Case 54: lbl1 = lbl1 + "6" Case 55: lbl1 = lbl1 + "7" Case 56: lbl1 = lbl1 + "8" Case 57: lbl1 = lbl1 + "9" Case 48: lbl1 = lbl1 + "0" Case 46: lbl1 = lbl1 + "." Case 8: lbl1 = "" Case 47: byt = 4 sin1 = lbl1 lbl1 = "" Case 42: byt = 3 sin1 = lbl1 lbl1 = "" Case 45: byt = 2 sin1 = lbl1 lbl1 = "" Case 43: byt = 1 sin1 = lbl1 lbl1 = "" Case 13: Select Case byt: Case 1: sin2 = lbl1 **** = sin1 **** = sin2 sinanswer = sin1 + sin2 lbl1 = sinanswer Case 2: sin2 = lbl1 **** = sin1 **** = sin2 sinanswer = sin1 - sin2 lbl1 = sinanswer Case 3: sin2 = lbl1 **** = sin1 **** = sin2 sinanswer = sin1 * sin2 lbl1 = sinanswer Case 4: sin2 = lbl1 **** = sin1 **** = sin2 sinanswer = sin1 / sin2 lbl1 = sinanswer End Select End Select End Sub Rem lbl1 is the "screen" on the calc. Private Sub cmd1_Click(index As Integer) lbl1 = lbl1 + "1" lbl1 = lbl1 + "1" End Sub Private Sub cmd2_Click(index As Integer) lbl1 = lbl1 + "2" End Sub Private Sub cmd3_Click(index As Integer) lbl1 = lbl1 + "3" End Sub Private Sub cmd4_Click(index As Integer) lbl1 = lbl1 + "4" End Sub Private Sub cmd5_Click(index As Integer) lbl1 = lbl1 + "5" End Sub Private Sub cmd6_Click(index As Integer) lbl1 = lbl1 + "6" End Sub Private Sub cmd7_Click(index As Integer) lbl1 = lbl1 + "7" End Sub Private Sub cmd8_Click(index As Integer) lbl1 = lbl1 + "8" End Sub Private Sub cmd9_Click(index As Integer) lbl1 = lbl1 + "9" End Sub Private Sub cmdAdd_Click(index As Integer) byt = 1 sin1 = lbl1 lbl1 = "" End Sub Private Sub cmdClear_Click() lbl1 = "" End Sub Private Sub cmdDecimal_Click(index As Integer) lbl1 = lbl1 + "." End Sub Private Sub cmdDiv_Click() byt = 4 sin1 = lbl1 lbl1 = "" End Sub Private Sub cmdEqual_Click(index As Integer) Select Case byt: Case 1: sin2 = lbl1 ***** = sin1 ***** = sin2 sinanswer = sin1 + sin2 lbl1 = sinanswer Case 2: sin2 = lbl1 ***** = sin1 ***** = sin2 sinanswer = sin1 - sin2 lbl1 = sinanswer Case 3: sin2 = lbl1 ***** = sin1 ***** = sin2 sinanswer = sin1 * sin2 lbl1 = sinanswer Case 4: sin2 = lbl1 ***** = sin1 ***** = sin2 sinanswer = sin1 / sin2 lbl1 = sinanswer End Select End Sub Private Sub cmdMult_Click() byt = 3 sin1 = lbl1 lbl1 = "" End Sub Private Sub cmdSub_Click() byt = 2 sin1 = lbl1 lbl1 = "" End Sub
__________________ Rutgers University School Of Engineering 2007 "skin and tragedy are the ways to attract a crowd" |
| ||||
Let me say this: Congrads!!! ![]() In like less than a week, you learned more VB than my teacher told us in like 3 mnth! All he told us are simple things like making the label magically display word "Hello World!" and a little bit of everyhting like If statements and properties of things...
__________________ !!!!Leafs are still #1!!!! ![]() |
| ||||
Quote:
![]() I'm using Sam's Teach yourself VB in 24 hours, if anyone is curious. It's a great book so far, and it comes with a CD with source and such. Still I have a few questions; How to make KeyPress() work with every keypress? and why do I get errors from this? Private Sub Command1_Click() msgbox(Tesing,vbOKOnly,Testing) End Sub It says "expected ="
__________________ Rutgers University School Of Engineering 2007 "skin and tragedy are the ways to attract a crowd" |
| ||||
MSG Box: MsgBox "Put the text to display here",<you can just leave this blank>,"Title" so you don't really have to use VBokOnly unless you want to. Wthout it it would look like this: MsgBox "Hello there!",,"Hi" . Key Press: here is an example: Private Sub txtans_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then MsgBox "you pressed Enter",,"Key Press Detected!" Else End If So, I apllied the code to the place when you're focused on the txtans text box, and if press enter that happens. But how to make any key activate the thig I dont' know... If you want something else to do soemthing when you press Enter, double click on that object, in the Procidure list (that drop down menu on the top right), select KeyPress, then type in the code. ![]()
__________________ !!!!Leafs are still #1!!!! ![]() Last edited by Super; 28th March, 2002 at 04:32 AM. |
| ||||
OK, i got it!! I didn't get that in "X_Y()" the x was the object is focus. Ok, but how can I make on object on the form always in focus? Can I remove the tab index from the buttons on the calc? I want it to always respond to keypresses.
__________________ Rutgers University School Of Engineering 2007 "skin and tragedy are the ways to attract a crowd" |
| ||||
I guess so. Thats what I did with my other program. Just removed tab stop from the rest of the buttons. But I know there is a function, but can't remember the name. You enable it only on one button, and whenever user presses Enter, that button is always activated.
__________________ !!!!Leafs are still #1!!!! ![]() |
| ||||
Quote:
__________________ Rutgers University School Of Engineering 2007 "skin and tragedy are the ways to attract a crowd" |
| ||||
Quote:
![]() You need to use a Network share and writing and reading files so that up to 10 people can talk. Use a timer or random # generator to prevent more than 1 person from accessing the file at once.
__________________ "And, most of all, remember this descendant of David who beat the hell out of death." -from the book "Six Hours One Friday" by Max Lucado "You have to go outside the sequence of engines, into the world of men, to find the real originator of the rocket. Is it not equally reasonable to look outside nature for the real Originator of the natural order? -C.S. Lewis Director of JavaScript section of the Allied Sites Support Team, web designer and programmer for DaOCPlace, and co-web designer and programmer for AOA Files Avatar by Epox Tech ![]() <>< I Believe-Do You? |
| ||||
I made a program this fall which basically takes your "ghetto chat" program to the next level. It is basically an autoresponder for AIM. Instead of chatting to you, it chats to people on instant messenger. It takes input from the conversation text box, removes everything except for what was last said, generates a response, and then sends it. Its not a very complicated concept but its very neat! Its always nice to stick this thing on people you don't really want to talk to. I made a BAS file with functions to simplify communication with AIM. If anyone wants a copy, send me an email: apd2002@columbia.edu. I'll clean it up, explain the functions, and explain how the API works as well. Claudius
__________________ |
| ||||
Quote:
|
| |||
Quote:
![]() I managed to find one, how sad is that?
__________________ Michael Lewis Disappointed Main Rig: AMD XP 2000+ @ 1790Mhz (142Mhz FSB), Leadtek Winfast K7N415DA Mobo, Leadtek WinFast A250LE TD GF4 Ti4200 64MB @ 305/589, Crucial 256MB DDR PC2100 RAM, 92GB hard drive space, Chieftec Scorpio TX-10BD Case, 2 Papst 80mm Case Fans (40cfm each), Akasa AK-821 2Q Silent CPU Cooler (20cfm). Win XP Pro. 45C idle, 54C full load. 3DMark2001SE: 11020 Server: AMD K6-2 500Mhz @ 550Mhz (110Mhz FSB), Gigabyte GA-5AX Mobo, S3 Trio 4MB, 224MB P100 RAM, stock CPU cooler. Win 2000 Pro |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Rate This Thread | |
| |