Textbox problem! TB-RPG. Help needed....VBEE08

a textbased rpg game--->"Mathtest" problem...

Page 1 of 1

8 Replies - 923 Views - Last Post: 23 January 2009 - 01:31 PM Rate Topic: -----

#1 Dr.No_0B[SwE]  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 47
  • Joined: 22-January 09

Textbox problem! TB-RPG. Help needed....VBEE08

Posted 23 January 2009 - 04:19 AM

hi im doing a textbased game and im stuck on a "mathtest" i gonna do in the game

on the form its many things but i just gonna write that i want help with:)

the Form:
label1 = "5x5"
label2 = "="
label3 = "" (gonna show "Correct")
label4 = "" (gonna show "Wrong")
textbox
button1

ok that was the stuff....

heres the code: (not long and not advanced but im a beginner)


Label3.Text = "correct" & TextBox1.Text & "25"




i want to make that the label4 (Wrong) shows if the text not "25" when you press the button

MVH Dr.No_0B[SwE]

This post has been edited by Dr.No_0B[SwE]: 23 January 2009 - 04:22 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Textbox problem! TB-RPG. Help needed....VBEE08

#2 dklingman  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 33
  • View blog
  • Posts: 263
  • Joined: 23-December 08

Re: Textbox problem! TB-RPG. Help needed....VBEE08

Posted 23 January 2009 - 06:05 AM

use an if...then...else statement
Was This Post Helpful? 1
  • +
  • -

#3 Dr.No_0B[SwE]  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 47
  • Joined: 22-January 09

Re: Textbox problem! TB-RPG. Help needed....VBEE08

Posted 23 January 2009 - 07:22 AM

thx mate :^:

i will try it right away :^:
Was This Post Helpful? 0
  • +
  • -

#4 Dr.No_0B[SwE]  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 47
  • Joined: 22-January 09

Re: Textbox problem! TB-RPG. Help needed....VBEE08

Posted 23 January 2009 - 08:26 AM

i can't get it to work the code now is:

   Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
		Label1.Text = "correct"
		If TextBox1.Text & "25" Then
			Else If TextBox1.Text not "25" then label2.Text = "Wrong" & textbox1.text		
End If
   End Sub
End Class


not "25" then label2.Text = "Wrong" & textbox1.text


the red text is the "End of statement expected" ERROR... :v:

i dont really know what thats meen :v:

i hope someone have an idea or something that might help me on the way, i learned something with the if... else... then... suggestion :^: THX

MVH Dr.No_0B[SwE]

This post has been edited by Dr.No_0B[SwE]: 23 January 2009 - 08:32 AM

Was This Post Helpful? 0
  • +
  • -

#5 dklingman  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 33
  • View blog
  • Posts: 263
  • Joined: 23-December 08

Re: Textbox problem! TB-RPG. Help needed....VBEE08

Posted 23 January 2009 - 08:46 AM

have a look at this link
http://www.startvbdo...age/ifthen.aspx
Was This Post Helpful? 1
  • +
  • -

#6 Dr.No_0B[SwE]  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 47
  • Joined: 22-January 09

Re: Textbox problem! TB-RPG. Help needed....VBEE08

Posted 23 January 2009 - 09:25 AM

THX again mate :^:
Was This Post Helpful? 0
  • +
  • -

#7 dklingman  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 33
  • View blog
  • Posts: 263
  • Joined: 23-December 08

Re: Textbox problem! TB-RPG. Help needed....VBEE08

Posted 23 January 2009 - 09:46 AM

not a problem. i'm trying to help you by forcing you to learn. trust me it's the best way, even if it doesn't feel like it. ;)
Was This Post Helpful? 1
  • +
  • -

#8 Dr.No_0B[SwE]  Icon User is offline

  • New D.I.C Head
  • member icon

Reputation: 0
  • View blog
  • Posts: 47
  • Joined: 22-January 09

Re: Textbox problem! TB-RPG. Help needed....VBEE08

Posted 23 January 2009 - 12:48 PM

i got it now :^: :D

the code was so simple:

  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

		Dim keyin As Integer
		keyin = Val(TextBox1.Text)

		If TextBox1.Text = 25 Then

			Label2.Text = ("Correct")

		Else
			
			Label1.Text = ("Wrong")

		End If


TY very much and i learned on the way :^: many thx from
Dr.No_0B[SwE]
Was This Post Helpful? 0
  • +
  • -

#9 dklingman  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 33
  • View blog
  • Posts: 263
  • Joined: 23-December 08

Re: Textbox problem! TB-RPG. Help needed....VBEE08

Posted 23 January 2009 - 01:31 PM

not a problem ;)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1