5 Replies - 2123 Views - Last Post: 26 October 2006 - 09:54 PM Rate Topic: -----

#1 squared  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 12-September 06

Help needed: codes for text boxes, command buttons, etc.

Posted 13 September 2006 - 12:01 AM

Hey there, I am making a game at school in Visual Basic 6.0 and I need a little bit of help with the coding..

The game I'm making, is a children's game where the picture shows and they must type the word in the text box below, then click the 'Enter' button. When they have spelt a word correctly, a star picture is added to their tally and they will move onto the next word, when they spell 10 correctly, they win the game. If they spell a word incorrectly, a message will show saying that they have done so and to have another try, they get three attempts then the word is shown to them and they move on to the next word..

It probably sounds easy as pie to you smart guys outs there, but I'm just beginning and I really do need some help.

If anyone could make up some coding that will help me with any aspect of my game, I would really, really, REALLY appreciate it!!!

Thanks guys!!
:blink:

Is This A Good Question/Topic? 0
  • +

Replies To: Help needed: codes for text boxes, command buttons, etc.

#2 Louisda16th  Icon User is offline

  • dream.in.assembly.code
  • member icon

Reputation: 15
  • View blog
  • Posts: 1,967
  • Joined: 03-August 06

Re: Help needed: codes for text boxes, command buttons, etc.

Posted 13 September 2006 - 01:43 AM

post whatever code uve written (since its vb. describe ure form also). It doesn't matter if its wrong. Post whatever u have and u'll get help.
Was This Post Helpful? 0
  • +
  • -

#3 squared  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 12-September 06

Re: Help needed: codes for text boxes, command buttons, etc.

Post icon  Posted 14 September 2006 - 03:10 AM

Well, that's the problem. I don't exactly know where to begin the code etc. :huh:

Basically, the user types the word of whatever the picture is, for example, a dog (lol) and if they do type 'dog' then they go to the next form with the next word. If they get it wrong, a message will show and they try again. They get three attempts then it will show them the spelling and they move on. They spell 10 words correctly they win. There's also the 'exit' button and 'new game' button.

Really sorry for my very un-programmer like explanation, but I'm just starting out, bit of a noob.

Basically, I'm trying to find the code of: how to make it progress at a correct answer and how to make it not at a wrong answer.. How they win when they get 10 correct and the new game button..

All the code I have now, is the exit button

Thankyou for your help B)
Was This Post Helpful? 0
  • +
  • -

#4 Willyj  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 11-October 06

Re: Help needed: codes for text boxes, command buttons, etc.

Posted 11 October 2006 - 02:49 PM

View Postsquared, on 13 Sep, 2006 - 12:01 AM, said:

Hey there, I am making a game at school in Visual Basic 6.0 and I need a little bit of help with the coding..

The game I'm making, is a children's game where the picture shows and they must type the word in the text box below, then click the 'Enter' button. When they have spelt a word correctly, a star picture is added to their tally and they will move onto the next word, when they spell 10 correctly, they win the game. If they spell a word incorrectly, a message will show saying that they have done so and to have another try, they get three attempts then the word is shown to them and they move on to the next word..

It probably sounds easy as pie to you smart guys outs there, but I'm just beginning and I really do need some help.

If anyone could make up some coding that will help me with any aspect of my game, I would really, really, REALLY appreciate it!!!

Thanks guys!!
:blink:



Private Sub cmdClear_Click()
txtSpell.Text = ""

End Sub

Private Sub cmdEnter_Click()
Dim img1 As Image
txtSpell.Text = "star"

If txtSpell.Text = "star" Then
pic1.Visible = True
End If
If txtSpell.Text = "no star" Then
pic1.Visible = False
End If
End Sub

This is a real simple and quick start to your syntax for your game. I hope it is will help. Willyj
Was This Post Helpful? 0
  • +
  • -

#5 dodong_johnjohn  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 17-October 06

Re: Help needed: codes for text boxes, command buttons, etc.

Post icon  Posted 17 October 2006 - 08:15 PM

to start here's my simple piece of advice

*********************************
Private sub cmdEnter_onclick()
if trim(txtspell.text)="animal_name" then
animalpicture.visible=true
msgbox "You've Got it Right!"
nextform.show
unload me
else
msgbox "Wrong Spelling! Try Again!"
endif
end sub
********************************
note:
I use a trim command to remove trailing and leading spaces of the entered word.
Was This Post Helpful? 0
  • +
  • -

#6 KeyWiz  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 8
  • View blog
  • Posts: 438
  • Joined: 26-October 06

Re: Help needed: codes for text boxes, command buttons, etc.

Post icon  Posted 26 October 2006 - 09:54 PM

Create a form with 1 picturebox, 1 textbox and 1 button

create a cow image and put it at

c:\My Images\Cow.bmp

copy and paste this code to the form (remoe the existing Form_Load procedure)

[code]
Option Explicit
Public thisImage As String
Public thisWord As String
Public correctAnswers As Integer
Public msgOK

Private Sub Command1_Click()
Unload Me
End Sub

Private Sub Form_Load()
GetNextPicture
End Sub

Private Sub GetNextPicture()

'look up your next image
' there are many ways to do this, I can't do it all for you
' I will use only 1 image "c:\My Images\Cow.bmp"

thisImage = "c:\My Images\Cow.bmp"
thisWord = "Cow"
Text1.Text = "" ' empty textbox
'display your image
Picture1.Picture = LoadPicture(thisImage)
Picture1.Refresh

End Sub

Private Sub Form_Unload(Cancel As Integer)
Close All ' close all datasources
End ' exit program
End Sub

Private Sub Text1_Change()

If Text1.Text = LCase(thisWord) Then
msgOK = MsgBox("Thats Right!!!!", vbOKOnly)
correctAnswers = correctAnswers + 1
If correctAnswers >= 5 Then
msgOK = MsgBox("Fantasic! you are done!", vbOKOnly)
Unload Me ' call closing routine (same as clicking X in form corner)

End If
GetNextPicture
Else
' if user types two letter more than word length
If Len(Text1.Text) > (Len(thisWord) + 2) Then
msgOK = MsgBox("I'm sorry, try again", vbOKOnly)
Text1.Text = ""
End If
End If
End Sub
[code]
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1