AOA Forums AOA Forums AOA Forums Folding For Team 45 AOA Files Home Front Page Become an AOA Subscriber! UserCP Calendar Memberlist FAQ Search Forum Home


Go Back   AOA Forums > Software > Programming and Assembly Language

Programming and Assembly Language Please read this Topic's rules!!


Reply
 
LinkBack Thread Tools Rate Thread
  #1 (permalink)  
Old 27th March, 2002, 01:44 AM
Cyberey66's Avatar
Member
 
Join Date: January 2002
Posts: 501
Send a message via AIM to Cyberey66

Need help practicing VB

I just started learning VB, but I am so happy to find out it's the same coding as my calcualator! Well, I need to practice writing simple programs. Anyone have any idea of programs I can write? I want a simple program that would still have a challenge, and that you could possibly point me in the direction to start. I know this is very ambiguous, but I can't think of an idea. I just started like 3 days ago, so nothing super hard, but I do know most of BASIC from calculator programing.

If anyone has the projects from simple programs they wrote, it would be very appreciated if they could email it to me so I can examine it.

- Cyberey66
__________________
Rutgers University School Of Engineering 2007

"skin and tragedy are the ways to attract a crowd"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 27th March, 2002, 04:11 AM
Superman's Avatar
Systems Administrator
 
Join Date: September 2001
Location: WI
Posts: 4,406
Send a message via ICQ to Superman

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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 27th March, 2002, 04:31 AM
Cyberey66's Avatar
Member
 
Join Date: January 2002
Posts: 501
Send a message via AIM to Cyberey66

Can you point me in a direction to start? Actually, I'll just talk to you on AIM when you are on.
__________________
Rutgers University School Of Engineering 2007

"skin and tragedy are the ways to attract a crowd"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 27th March, 2002, 07:23 PM
Super's Avatar
Member
 
Join Date: September 2001
Location: Mississauga, Canada
Posts: 535
Send a message via ICQ to Super Send a message via AIM to Super

Quote:
Originally posted by Cyberey66
Actually, I'll just talk to you on AIM when you are on.
hahaha, good luck!

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!!!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 28th March, 2002, 12:00 AM
Cyberey66's Avatar
Member
 
Join Date: January 2002
Posts: 501
Send a message via AIM to Cyberey66

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
Attached Files
File Type: zip calc.zip (15.8 KB, 162 views)
__________________
Rutgers University School Of Engineering 2007

"skin and tragedy are the ways to attract a crowd"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 28th March, 2002, 04:07 AM
Super's Avatar
Member
 
Join Date: September 2001
Location: Mississauga, Canada
Posts: 535
Send a message via ICQ to Super Send a message via AIM to Super

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!!!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 28th March, 2002, 04:17 AM
Cyberey66's Avatar
Member
 
Join Date: January 2002
Posts: 501
Send a message via AIM to Cyberey66

Quote:
Originally posted by Super
In like less than a week, you learned more VB than my teacher told us in like 3 mnth!
Well, i already knew BASIC, so I just basically(no pun intended) used what I knew combined with the new stuff I learned about the visual aspects.

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"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 28th March, 2002, 04:29 AM
Super's Avatar
Member
 
Join Date: September 2001
Location: Mississauga, Canada
Posts: 535
Send a message via ICQ to Super Send a message via AIM to Super

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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 28th March, 2002, 04:38 AM
Super's Avatar
Member
 
Join Date: September 2001
Location: Mississauga, Canada
Posts: 535
Send a message via ICQ to Super Send a message via AIM to Super

Here is the first major project that was assigned to my class... If you want the code, tell me.
Attached Files
File Type: zip vbapp1f.zip (8.9 KB, 151 views)
__________________
!!!!Leafs are still #1!!!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 28th March, 2002, 04:45 AM
Cyberey66's Avatar
Member
 
Join Date: January 2002
Posts: 501
Send a message via AIM to Cyberey66

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"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #11 (permalink)  
Old 28th March, 2002, 04:56 AM
Super's Avatar
Member
 
Join Date: September 2001
Location: Mississauga, Canada
Posts: 535
Send a message via ICQ to Super Send a message via AIM to Super

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!!!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #12 (permalink)  
Old 29th March, 2002, 09:24 AM
Cyberey66's Avatar
Member
 
Join Date: January 2002
Posts: 501
Send a message via AIM to Cyberey66

Quote:
Originally posted by Superman53142
How about a simple chat program.
I think i made the simplest and most getto chat program. I only support one user, but it has a bot to talk to. I could use it to practice my VB on. Maybe I'll add a game you can play with the bot, or later somehow make it so you can login as your own name. I also updated my calculator, now it only has one bug, and I don't think you will find it. VB is pretty fun. I attached the getto chat program if you are interested.
Attached Files
File Type: zip chat.zip (21.3 KB, 134 views)
__________________
Rutgers University School Of Engineering 2007

"skin and tragedy are the ways to attract a crowd"
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #13 (permalink)  
Old 29th March, 2002, 06:30 PM
Superman's Avatar
Systems Administrator
 
Join Date: September 2001
Location: WI
Posts: 4,406
Send a message via ICQ to Superman

Quote:
Originally posted by Cyberey66


I think i made the simplest and most getto chat program. I only support one user, but it has a bot to talk to. I could use it to practice my VB on. Maybe I'll add a game you can play with the bot, or later somehow make it so you can login as your own name. I also updated my calculator, now it only has one bug, and I don't think you will find it. VB is pretty fun. I attached the getto chat program if you are interested.
Doesn't count

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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #14 (permalink)  
Old 25th April, 2002, 10:49 PM
Claudius's Avatar
Member
 
Join Date: March 2002
Location: NYC
Posts: 40
Send a message via AIM to Claudius

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
__________________
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #15 (permalink)  
Old 27th April, 2002, 12:34 AM
SiGmA_X's Avatar
Member
 
Join Date: April 2002
Location: Portland, OR
Posts: 1,529
Send a message via ICQ to SiGmA_X Send a message via AIM to SiGmA_X Send a message via MSN to SiGmA_X Send a message via Yahoo to SiGmA_X

Quote:
Originally posted by Superman53142


Doesn't count

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.
At my school we learn basicly NOTHING in the VB class. So I sit around on AOA Forums (You know it!) and work on my chat client. The teacher doesn't like us using WinSock tho, so its a bit of a ***** with him... Ill post a multi-client program when its done..
__________________
"In war, it is not the goal to die for your country, but rather to make the other bastard die for his!"
AOA Team fah
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #16 (permalink)  
Old 20th May, 2002, 07:28 PM
SiGmA_X's Avatar
Member
 
Join Date: April 2002
Location: Portland, OR
Posts: 1,529
Send a message via ICQ to SiGmA_X Send a message via AIM to SiGmA_X Send a message via MSN to SiGmA_X Send a message via Yahoo to SiGmA_X

Is there a way in VB to make the CD-ROM drive open on command? Please help!
__________________
"In war, it is not the goal to die for your country, but rather to make the other bastard die for his!"
AOA Team fah
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #17 (permalink)  
Old 20th May, 2002, 08:15 PM
Super's Avatar
Member
 
Join Date: September 2001
Location: Mississauga, Canada
Posts: 535
Send a message via ICQ to Super Send a message via AIM to Super

Here is a program I found on the net that might help you. Check the eject button code.
Attached Files
File Type: zip cdplayer.zip (4.8 KB, 142 views)
__________________
!!!!Leafs are still #1!!!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #18 (permalink)  
Old 6th September, 2002, 02:45 PM
Member
 
Join Date: January 2002
Posts: 451
Send a message via ICQ to ByteWipe

Quote:
Originally posted by Cyberey66

I also updated my calculator, now it only has one bug, and I don't think you will find it. .
You get a buffer overflow if you enter an integer which is too long to fit in your variable

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 04:06 PM.


Copyright ©2001 - 2023, AOA Forums
Don't Click Here Don't Click Here Either

Search Engine Friendly URLs by vBSEO 3.3.0