Please Help Me With These Questions. Desperate

D Saunders

New member
Joined
Nov 27, 2005
Messages
4
Programming Experience
Beginner
1. I need a horizontal scroll bar that controls the intensity of the colour red displayed in a label. That is the background colour of the label is controlled by the position of the slider on the horizontal scroll bar.

Add another label. Display in the value property of the horizontal scroll bar in the second label when the user moves the slider.

I need the codes for this question please


2.a. Write at program that asks the user to enter a positive number and have the program report the entry of a negative number. Attach the program to a form click event. Tip: "if"

b. write a program that asks the user to enter their age. If they are old enough to vote the program reports back their age and asks them to collect their polling card, however, if they are not old enough to vote the program again reports back their age but this time tells them that they are too young to vote. Attach the program to a form click event.

c. amend 7b. So that if the user enters their age as 17 they are told that they can vote next year. Tip: "else if"

I dont have a clue how to do question 2.

please help
 
1. use the horizontal scrollbar, it's in your toolbox

2. a you'll want to use a textbox (though i would use the numericupdown control)

b. numericupdown control here too

c. just check the control to see if it's 17 or higher
 
about the questions

thanx for the help mate. but i was hoping if u could give me the code for the private sub for question 1.any chance ?
im not a regular user of VB
 
first answer

minimum value=0
maximum value=264

VB.NET:
Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar1.Scroll
        Label1.Text = e.NewValue
        Label1.BackColor = Color.FromArgb(e.NewValue, 0, 0)
End Sub
 
you should use simple if else OR switch structure for this simple program
VB.NET:
if age>17 then
----
elseif age<17 then
----
else
-----
end if

VB.NET:
if number>-1 then
----
end if
 
aniskhan said:
you should use simple if else OR switch structure for this simple program
VB.NET:
if age>17 then
----
elseif age<17 then
----
else
-----
end if
VB.NET:
if number>-1 then
----
end if
VB.NET:
Select Case age
  Case Is >= 17
    'Is 17 or older
  Case Else
    'under 17
End Select
and
VB.NET:
If number <= -1 Then
  'Is negative
End If
 
Back
Top