Help - Search - Members - Calendar
Full Version: Help Needed Here (visual Basic)!
BleepingComputer.com > Software > Programming
   
f1f2
Programmers, please help me here!!!?

Okay this is our project in Computer Science. This is all about VB:

1. Rewrite the following nested If statement using a single If with a logical operator:
If (level >= 2) Then
If (course = "BSCS") Then
lblResult.Caption = "Qualified Member"
End If
End If

2. Rewrite the following If statement to eliminate the Not. The logic should still be the same.

If Not(A < 4) Or Not(college = "Engineering")Then

3. Write a program that contains a TextBox and a CommandButton. Put a Label above the TextBox that tells the user to type a number from 1 to 10 inside the TextBox. Display a default value of 0. When the user clicks the CommandButton, check the TextBox for a valid number. Display "Valid Number" in another Label if the number is within the range. Display "Invalid Number. Please enter a number from 1 to 10." when the entered value is out of range.


There! Pls help!!
groovicus
Standard policy for homework is that you show us the code that you do have and then we would be glad to try and help you find the correct solution. smile.gif
f1f2
this is what ive got,, tell me if its okay...

1.

If (level >= 2) And (course = "BSCS") Then
lblResult.Caption = "Qualified Member"
End If

is it correct?
i'm just a noob in our class, i can't understand VB so much...
groovicus
The logic is correct, but I can't comment on the syntax. I do not use VB so I am not familiar with it.
ussr1943
from what i know that is the correct syntax, the AND operator is a boolean operator so if both statements are true Then Statement block1 executes
ex.

If (First Expression) AND (Second Expression) Then
Statement Block
End If
visual basic is a very good language too learn, heck any computer language is good to learn.
have fun.
and if you get to a problem you are having a hard time with
1.write out what you want your program to do in plain english so you can understand perfect.
2.create the user interface
3.turn what you wrote down into code, and for any statements or operaters your unsure of, check your text book, or with a friend, or teacher.
4. have fun.
f1f2
^^ so instead of using AND, should i put OR?
ussr1943
i'm not sure what your asking. what you put before should be correct for the one double if statement.
as for the second one, show me the code that you tried already.
and please explain what you want the second one to do, are you trying to see if both values are false? or one value is false?
becuase if you want to see if both values are false i can give you a hint, look at your expressions
ex.
If Not (A < 4) ' look at the A < 4 part
how could you change this one operator to make
the not statement go aaway? you want to find if A is not less than 4, whats another operator that could be used?
and same with the engineering, whats another statement that is not equall.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.