473,543 Members | 2,496 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

having problems with else if error

1 New Member
hi
i am a novice programer and i am having trouble with vb already
it is showing COMPILE ERROR :ELSE WITHOUT IF
please help me

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Command1_Click()
  3.  
  4. If Text1.Text = "DDRC" Then Form1.Show
  5.  
  6. Else: MsgBox = vbAbort
  7.  
  8. End If
  9.  
  10.  
  11. End Sub
  12.  
Dec 16 '11 #1
3 1449
Guido Geurs
767 Recognized Expert Contributor
not "Else:" but "Else"
Dec 16 '11 #2
kadghar
1,295 Recognized Expert Top Contributor
actually "Else:" is fine, since it's a line change mark.

The real error is that IF has two forms

1)IF condition THEN ActionA [ELSE ActionB]
2)Multiline for multi actions. (IF THEN / ELSE / END IF)

Your IF statement is of the first form... and then you put other lines. So just put "Form1.Show " into the next line, and you're done.
Dec 16 '11 #3
Guido Geurs
767 Recognized Expert Contributor
Of course, sorry I did not see this one.
I never use ":" because I always indent my code: it's easier to read and easier to detect code errors.
Expand|Select|Wrap|Line Numbers
  1. If (condition) then (action1) : (action2) else (action3) : (action4)
becomes:
Expand|Select|Wrap|Line Numbers
  1. If (condition) then 
  2.    (action1)
  3.    (action2)
  4. else 
  5.    (action3)
  6.    (action4)
  7. end if
  8.  
Dec 17 '11 #4

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

Similar topics

8
1710
by: Michael C | last post by:
Hi all, I'm still having problems with VS.NET 2003 running on my XP machine. I finally decided I might as well uninstall completely and reinstall from scratch. But lo and behold it won't let me uninstall... It gets stuck about 2/3rds of the way through the uninstall (based on the progress bar) and hangs for a very, very long time (a few...
4
1603
by: Charles | last post by:
I am still having problems with sessions crossing over from other sessions. What I mean by this is that Mary may get just some or all of Renae’s information. I think that what is going on with this problem is the way that I have the solution setup I have this .NET CEmployees class that I am storing into a session object. The sessions are...
7
1794
by: Ron | last post by:
Hi All, It's taking a long, LONG time for me to see a post from here (and other NGs too, for that matter--which is why I think it may be me...). Sometimes it takes 2-3 minutes after clicking the post for me to be able to read it. And sometimes, it never comes up..instead I get "Message is no longer available on the server". Also, like...
2
1727
by: l46kok | last post by:
Hello. This is the first time I'm encountering vectors and I'm having problems. I want to create a vector filled with objects, but as soon as I try to invoke a function within the object, I get an error message stating "Vector out of subscript range". And I'm using
1
2767
by: tshad | last post by:
Some of my regular expressions don't seem to work correctly in IE7. I am on asp.net 1.1. I have a site that has been up for a while and I started having problems on machines with IE7. IE5 and IE6 seem to work fine. In the following - 919-111-2222 as well as (919)111-2222 was giving one of my clients the error message and IsValidate was...
3
1589
by: i80and | last post by:
I'm working on a basic web spider, and I'm having problems with the urlparser. This is the effected function: ------------------------------ def FindLinks(Website): WebsiteLen = len(Website)+1 CurrentLink = '' i = 0 SpliceStart = 0 SpliceEnd = 0
4
2091
by: chris | last post by:
Hello all, I am having problems getting Apache 2.2.4 to read the php_mysqli.dll file some my C:\php\ext\ directory. The following is the error that Apache displays in the error log: PHP Warning: PHP Startup: Unable to load dynamic library 'C:/php/ext/ php_mysqli.dll' - The specified procedure could not be found.\r\n in Unknown on line 0...
6
2162
by: fpcreator2000 | last post by:
Hello everyone. I'm having problems with a page I've created that is used to insert data into a database. It uploads two files into two distinct folder, and it takes the filenames and inserts them into a MYSQL database along with other product information. Here is the entire .php file. I list it because the errors are not showing at all, and...
3
1941
by: Blondie1966 | last post by:
Ok Im still having problems, Im wanting the name that I enter as the truck name to always be the same, so if the user is asked to enter the truck name it must be one thing, and if anything other it shoud make the user retry, I dont want it to just put any name in, also the truck id is allowing the user again to put any number in and it takes it...
4
1786
by: lafayettejohnson | last post by:
there are 3 files but the one iam having problems with is the student.cpp student.cpp #include <iostream> // for ostream << and istream >> #include <string> #include "student.h" using namespace std;
0
7408
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7349
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7590
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7735
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7347
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
4895
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3391
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
968
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
636
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.