|
-
Apr 6th, 2003, 11:24 PM
#1
Thread Starter
Junior Member
NumericUpDown
whats with this damn thing. if i have numbers from 0 to 100 as grades how do i set it??
Private Sub numUpDown_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles numUpDown.ValueChanged
End Sub
lets say i wanted a textbox to print out the results of the numericUpDown * something = something
val(texbox.text) = something
?
is that right?
**one more thing whats with the print function damnit?
vb had the picbox.print function and this vb.net crap is all crap
Last edited by Newer_Newbie; Apr 6th, 2003 at 11:59 PM.
All Help Very Much Appreciated 
-
Apr 7th, 2003, 10:08 AM
#2
Addicted Member
frmMyform.nudGrades.value = 50
To set the grade you don't need to use the change event of the nud.
frmMyForm.tbMyTextBox.text = frmMyform.nudGrades.value
-
Apr 7th, 2003, 12:29 PM
#3
Thread Starter
Junior Member
All Help Very Much Appreciated 
-
Apr 7th, 2003, 02:03 PM
#4
Addicted Member
whats with this damn thing. if i have numbers from 0 to 100 as grades how do i set it??
You set the numupdown by using numupdown.value = whatever_your_number_is.
Like numUpDown.value = 80
lets say i wanted a textbox to print out the results of the numericUpDown * something = something
To set the textbox.text value equal to the numUpDown value you do it like
PHP Code:
Private Sub numUpDown_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles numUpDown.ValueChanged
textbox.text = NumUpDown.value
end sub
-
Apr 7th, 2003, 03:13 PM
#5
Thread Starter
Junior Member
ok the textbox print is cool thats what i thought.
but
You set the numupdown by using numupdown.value = whatever_your_number_is.
Like numUpDown.value = 80
end sub
is weird cuz by default i already set it to max num 100 min num 0 so why do i have to set anything inside the code? i mean im pretty good with VB6 but VB .NET is changed up a bit, not to much but its a bit different for me.
this is the code what i doing wrongm i never used the numericupdown function before thats why im going ape **** with it
------------------------------------
Dim none As Integer
Dim average As Integer
Dim aboveavg As Integer
Dim ontime As Integer
Dim twolate As Integer
Dim lateplus As Integer
Private Sub numUpDown_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles numUpDown.ValueChanged
maximum = 100
minimum = 0
End Sub
Private Sub chkNone_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkNone.CheckedChanged
none = 0
End Sub
Private Sub chkAverage_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkAvgerage.CheckedChanged
average = 3
End Sub
Private Sub chkcAboveAverage_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkAboveAverage.CheckedChanged
aboveavg = 5
End Sub
Private Sub chckOnTime_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chckOnTime.CheckedChanged
ontime = 0
End Sub
Private Sub chkTwoLate_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chkcTwoLate.CheckedChanged
twolate = -5
End Sub
Private Sub chkTwoPlus_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles chckTwoPlus.CheckedChanged
lateplus = 0
End Sub
Private Sub cmdComputeGrade_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdComputeGrade.Click
' Compute grade average upon selecting inputs, based upon days late and extra credit
Dim totalscore As Single
Dim none As Integer
Dim average As Integer
txtTotalScore.Text = ""
If chkNone = True Then
totalscore = none + numUpDown.Value
txtTotalScore.Text = totalscore
End If
End Sub
Last edited by Newer_Newbie; Apr 7th, 2003 at 03:30 PM.
All Help Very Much Appreciated 
-
Apr 7th, 2003, 04:13 PM
#6
Addicted Member
Originally posted by Newer_Newbie
is weird cuz by default i already set it to max num 100 min num 0 so why do i have to set anything inside the code?
You need to set the max and mins like: nuUpDown.maximum = 100, etc. It is easier to just use the properties options in the GUI.
You can set the value in the code. So if StudentA got a 85 on the test, you can load the form and then do numUpDown.value = 85 and the slider will start at 85 rather than the default starting spot.
-
Apr 7th, 2003, 05:42 PM
#7
Thread Starter
Junior Member
the GUI is already set at max = 100, min = 0, increment by 1
all it has is 6 radio buttons and a numericupdown object.
a textbox to display and a cmdbutton to active.
what im doing is if numeric is 90 and no extra credit radio button is click and o day late than its this grade, if this and this is click then its this grade and so on get it?
All Help Very Much Appreciated 
-
Apr 8th, 2003, 12:21 AM
#8
Addicted Member
Okay, so on the onChange event of the numUpDown and the onclick event of the radio buttons put a call to another sub
the sub would be like
private sub CalcGrade()
dim i as integer
i = numUpDown.value 'get the grade
if extracredit then ....
i += 5 'add 5 points
if daylate then...
i -= 5 ' minus 5 points
etc.
myTxtBox.text = cstr(i)
end sub
.... etc
(Note: this code is not proper code, just an example of rough code, etc.)
-
Apr 8th, 2003, 09:29 AM
#9
Thread Starter
Junior Member
ya that would be easy, but i have to use 6 radio buttons.
1 radio button is = 0
radio button 2 is +3
radio button 3 is + 5
radio button 4 is = 0
radio button 5 is - 5
and radio button 6 = -10
i need to have the buttons work when they picked but if they not picked i need them turned off
All Help Very Much Appreciated 
-
Apr 8th, 2003, 10:07 AM
#10
Addicted Member
PHP Code:
Private Sub numUpDown_ValueChanged(...
CalcGrade()
end sub
Private Sub radiobutton1_CheckedChanged(...
CalcGrade()
end sub
Private Sub radiobutton2_CheckedChanged(...
CalcGrade()
end sub
....
private sub CalcGrade()
Dim i As Integer
'get starting grade
i = numUpDown.value
If (RadioButton1.Checked) Then i += 0
If (RadioButton2.Checked) Then i += 3
If (RadioButton3.Checked) Then i += 5
If (RadioButton4.Checked) Then i += 0
If (RadioButton5.Checked) Then i -= 5
If (RadioButton6.Checked) Then i -= 10
textbox1.text = i
end sub
-
Apr 8th, 2003, 10:13 AM
#11
Thread Starter
Junior Member
let me try that out, thanks
All Help Very Much Appreciated 
-
Apr 8th, 2003, 10:22 AM
#12
Thread Starter
Junior Member
yo check this out and tell me what im doing wrong cuz i know its something with those damn .checked or autocheck properties
=================================
Dim grade As Integer
Dim none As Integer
Dim newaverage As Integer
Dim aboveaverage As Integer
Dim ontime As Integer
Dim twolate As Integer
Dim twoplus As Integer
Private Sub numUpDown_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles numUpDown.ValueChanged
If numUpDown.Text >= 0 And numUpDown.Text <= 100 Then
numUpDown.Text = numUpDown.Text
End If
End Sub
Private Sub optNone_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles optNone.CheckedChanged
optNone.Checked = 0
End Sub
Private Sub optNewAverage_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles optNewAverage.CheckedChanged
optNewAverage.AutoCheck = 3
End Sub
Private Sub optAboveAverage_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles optAboveAverage.CheckedChanged
optAboveAverage.AutoCheck = 5
End Sub
Private Sub optOnTime_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles optOnTime.CheckedChanged
optOnTime.Checked = 0
End Sub
Private Sub optTwoLate_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles optTwoLate.CheckedChanged
optTwoLate.AutoCheck = -5
End Sub
Private Sub optTwoPlus_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles optTwoPlus.CheckedChanged
optTwoPlus.AutoCheck = -10
End Sub
Private Sub cmdComputeGrade_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdComputeGrade.Click
' Compute grade average upon selecting inputs, based upon days late and extra credit
Dim totalscore As Single
txtTotalScore.Text = ""
If optNone.Checked = 0 And optOnTime.Checked = 0 Then
totalscore = 0 + 0 + numUpDown.Text
txtTotalScore.Text = totalscore
End If
End Sub
===============================
the numericUpDown Function works perfectly fine now, its havint those radio buttons clicked and turned off when other radio buttons are clicked thats the problem
All Help Very Much Appreciated 
-
Apr 8th, 2003, 12:04 PM
#13
Addicted Member
I don't understand what you are doing with those autocheck statements. I thought that autocheck was a boolean (true/false , 0/1, etc.)
Try to remove that code (the autocheck stuff) and put the if then statements in your button click event. Or if you do it like my code above, the grade will automatically be recalculated when you click on a radio button and the grade will be updated on the numupdown change, etc.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|