Jump to content


 


Register a free account to unlock additional features at BleepingComputer.com
Welcome to BleepingComputer, a free community where people like yourself come together to discuss and learn how to use their computers. Using the site is easy and fun. As a guest, you can browse and view the various discussions in the forums, but can not create a new topic or reply to an existing one unless you are logged in. Other benefits of registering an account are subscribing to topics and forums, creating a blog, and having no ads shown anywhere on the site.


Click here to Register a free account now! or read our Welcome Guide to learn how to use this site.

Photo

Help Needed Here (visual Basic)!


  • Please log in to reply
6 replies to this topic

#1 f1f2

f1f2

  • Members
  • 14 posts
  • OFFLINE
  •  
  • Local time:10:17 AM

Posted 20 October 2006 - 09:08 PM

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!!

BC AdBot (Login to Remove)

 


m

#2 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:09:17 AM

Posted 20 October 2006 - 09:19 PM

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. :thumbsup:

#3 f1f2

f1f2
  • Topic Starter

  • Members
  • 14 posts
  • OFFLINE
  •  
  • Local time:10:17 AM

Posted 21 October 2006 - 02:05 AM

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...

#4 groovicus

groovicus

  • Security Colleague
  • 9,963 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:Centerville, SD
  • Local time:09:17 AM

Posted 21 October 2006 - 11:26 AM

The logic is correct, but I can't comment on the syntax. I do not use VB so I am not familiar with it.

#5 ussr1943

ussr1943

  • Members
  • 490 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:USA
  • Local time:11:17 AM

Posted 21 October 2006 - 06:19 PM

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.
"Ideas are far more powerful than guns."
"The only truly secure system is one that is powered off, cast in a block of concrete and sealed in a lead-lined room with armed guards -- and even then I have my doubts." --Eugene H. Spafford
"One man's terrorist is another's freedom fighter"

#6 f1f2

f1f2
  • Topic Starter

  • Members
  • 14 posts
  • OFFLINE
  •  
  • Local time:10:17 AM

Posted 21 October 2006 - 10:04 PM

^^ so instead of using AND, should i put OR?

#7 ussr1943

ussr1943

  • Members
  • 490 posts
  • OFFLINE
  •  
  • Gender:Male
  • Location:USA
  • Local time:11:17 AM

Posted 22 October 2006 - 09:24 AM

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.
"Ideas are far more powerful than guns."
"The only truly secure system is one that is powered off, cast in a block of concrete and sealed in a lead-lined room with armed guards -- and even then I have my doubts." --Eugene H. Spafford
"One man's terrorist is another's freedom fighter"




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users