473,396 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

IF statement never works

37
what I need is if the text box = the second text then change but it always say it dosent i am useing vb2008 this is for a school spelling program it flash the spelling word then they type it. if they get it wrong then the same word should apper. the problem is that if they get the word right it dosent get a new word


Expand|Select|Wrap|Line Numbers
  1. If TextBox1.Text = TextBox2.Text Then
  2.   TextBox1.Text = ""
  3.   Number = Int((20 - 1 + 1) * Rnd()) + 1
  4.   'TextBox2.Text = number
  5.  
  6.   Select Case Number
  7.     Case 1
  8.       CHOSENWORD = My.Computer.FileSystem.ReadAllText("C:\the game attic inv\1.txt")
  9.     Case 2
  10.       CHOSENWORD = My.Computer.FileSystem.ReadAllText("C:\the game attic inv\2.txt")
  11.     Case 3
  12.       CHOSENWORD = My.Computer.FileSystem.ReadAllText("C:\the game attic inv\3.txt")
  13.     Case 4
  14.       CHOSENWORD = My.Computer.FileSystem.ReadAllText("C:\the game attic inv\4.txt")
  15.     Case 5
  16.       CHOSENWORD = My.Computer.FileSystem.ReadAllText("C:\the game attic inv\5.txt")
  17.     Case 6
  18.       CHOSENWORD = My.Computer.FileSystem.ReadAllText("C:\the game attic inv\6.txt")
  19.     Case 7
  20.       CHOSENWORD = My.Computer.FileSystem.ReadAllText("C:\the game attic inv\7.txt")
  21.     Case 8
  22.       CHOSENWORD = My.Computer.FileSystem.ReadAllText("C:\the game attic inv\8.txt")
  23.     Case 9
  24.       CHOSENWORD = My.Computer.FileSystem.ReadAllText("C:\the game attic inv\9.txt")
  25.     Case 10
  26.       CHOSENWORD = My.Computer.FileSystem.ReadAllText("C:\the game attic inv\10.txt")
  27.     Case 11
  28.       CHOSENWORD = My.Computer.FileSystem.ReadAllText("C:\the game attic inv\11.txt")
  29.     Case 12
  30.       CHOSENWORD = My.Computer.FileSystem.ReadAllText("C:\the game attic inv\12.txt")
  31.     Case 13
  32.       CHOSENWORD = My.Computer.FileSystem.ReadAllText("C:\the game attic inv\13.txt")
  33.     Case 14
  34.       CHOSENWORD = My.Computer.FileSystem.ReadAllText("C:\the game attic inv\14.txt")
  35.     Case 15
  36.       CHOSENWORD = My.Computer.FileSystem.ReadAllText("C:\the game attic inv\15.txt")
  37.     Case 16
  38.       CHOSENWORD = My.Computer.FileSystem.ReadAllText("C:\the game attic inv\16.txt")
  39.     Case 17
  40.       CHOSENWORD = My.Computer.FileSystem.ReadAllText("C:\the game attic inv\17.txt")
  41.     Case 18
  42.       CHOSENWORD = My.Computer.FileSystem.ReadAllText("C:\the game attic inv\18.txt")
  43.     Case 19
  44.       CHOSENWORD = My.Computer.FileSystem.ReadAllText("C:\the game attic inv\19.txt")
  45.     Case 20
  46.       CHOSENWORD = My.Computer.FileSystem.ReadAllText("C:\the game attic inv\20.txt")
  47.   End Select
  48. End If
  49.  
  50. TextBox2.Text = CHOSENWORD
  51. TextBox2.Visible = True
  52. Timer1.Enabled = True
  53.  
Mar 17 '08 #1
3 952
debasisdas
8,127 Expert 4TB
Better trim and convert the text to uppercase before comparing.

In which event you are comparing the text ?
Mar 18 '08 #2
radom
37
The first if statement
Mar 18 '08 #3
Killer42
8,435 Expert 8TB
Please let us know whether trimming and standardising the case help. If not, it'd help if you can show us a sample of the values that should match, but don't.
Mar 19 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Marcel | last post by:
<?php switch ($var) { case ("02100" || "02700" || "02500"): /* rest of code...... */
6
by: lovecreatesbeauty | last post by:
I ever missed a `return' statement when write a function `int HighDigit(Num)' to get the highest digit of an integer. But even if the `return' statement is ignored the function still can obtain...
15
by: Nerox | last post by:
Hi, If i write: #include <stdio.h> int foo(int); int main(void){ int a = 3; foo(a); }
12
by: Yannick | last post by:
Hi, I've got a problem accessing a ms-access db with a sql statement like this: SELECT * FROM laTable WHERE laDate = #05/21/2004# ; with asp.net (vb code) laTable contains a "laDate"...
4
by: Jack | last post by:
Hi, I have a asp page where part of the code is as follows. This builds up the sql statement partially. sql01 = "UPDATE EquipmentTbl SET " sql01 = sql01 & "SerialNumber = '" &...
4
by: Dave | last post by:
I have a field with data type of memo in my access database. I run a query from c# to access this field and it cuts off my string to only 255 characters. If i run this query directly in access...
13
by: eman1000 | last post by:
I was recently looking at the prototype library (http://prototype.conio.net/) and I noticed the author used the following syntax: Object.extend(MyObj.prototype, { my_meth1: function(){},...
5
by: TPJ | last post by:
I have the following code: ----------------------------------- def f(): def g(): a = 'a' # marked line 1 exec 'a = "b"' in globals(), locals() print "g: a =", a
7
by: Steven Bethard | last post by:
I've updated PEP 359 with a bunch of the recent suggestions. The patch is available at: http://bugs.python.org/1472459 and I've pasted the full text below. I've tried to be more explicit about...
11
by: npm | last post by:
Hi, I'm trying to add an IF statement to this javascript that will select/display only those xml nodes either with a certain attribute or attribute value. Here's my xml code: <stations>...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.