473,396 Members | 1,866 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.

Help with randomizer please.

Expand|Select|Wrap|Line Numbers
  1.         Dim A As Integer
  2.         Dim B As Integer
  3.         B = 0
  4.  
  5.         Dim LArray() As String = {"a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z"}
  6.         Dim SArray() As String = {"`, ~, !, @, #, $, %, ^, &, *, (, ), [, {, ], }, \, |, ;, :, ', /, ?, ., >, <"}
  7.         Dim LSArray() As String = {"a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z,`,~,!,@,#,$,%,^,&,*,(,),[,{,],},\,|,;,:,',/,?,.,>,<"}
  8.         If letterbox.Checked = True Then A = B + 1
  9.         end if
  10.         If symbolbox.Checked = True Then A = B + 10
  11.         end if
  12.         If A = 1 Then TextBox3.Text = LArray(Int(Rnd() * 25))
  13.         end if
  14.         If A = 10 Then TextBox3.Text = SArray(Int(Rnd() * 25))
  15.         end if
  16.         If A = 11 Then TextBox3.Text = LSArray(Int(Rnd() * 50))
  17.         end if
  18.  

The End If is underlined and said it needs a preceding 'If'

It does have one but for some reason it isn't recognizing it and I think I need brackets or parenthesis somewhere but I'm new to VB(thus the newb stuff) and I'm just making random stuff to help me learn it.

And for those wondering, it randomly generates a letter, a symbol, or a letter/symbol.

Please Help, Jack-O-VB
Feb 13 '07 #1
1 1043
Killer42
8,435 Expert 8TB
Not quite. An IF statement can be constructed in two ways. The single-line version is simply
Expand|Select|Wrap|Line Numbers
  1. If Condition Then DoSomething
The multi-line version is
Expand|Select|Wrap|Line Numbers
  1. If Condition Then
  2.   DoSomething
  3.   ...
  4. End If
In your case you need to either remove the End If, or split the "DoSomething" code onto a separate line. the choice is yours.

Side note: in checking multiple values of A in that way, you should check out the Select Case statement.
Feb 13 '07 #2

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

Similar topics

4
by: matt | last post by:
I have an image randomizer that was working fine. I added five images to it today, and none of the new five are ever called. Here's the script: <!-- Begin var theImages = new Array() ...
7
by: x muzuo | last post by:
Hi guys, I have got a prob of javascript form validation which just doesnt work with my ASP code. Can any one help me out please. Here is the code: {////<<head> <title>IIBO Submit Page</title>...
5
by: Craig Keightley | last post by:
Please help, i have attached my page which worksin IE but i cannnot get the drop down menu to fucntion in firefox. Any one have any ideas why? Many Thanks Craig ...
23
by: Jason | last post by:
Hi, I was wondering if any could point me to an example or give me ideas on how to dynamically create a form based on a database table? So, I would have a table designed to tell my application...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.