There that's the solution
Private Sub scoreTextBox3_GotFocus(sender As Object, e As EventArgs) Handles scoreTextBox3.GotFocus
scoreTextBox3.SelectAll()
End Sub
Private Sub scoreTextBox_KeyPress(sender As Object, e As KeyPressEventArgs) Handles scoreTextBox.KeyPress, scoreTextBox2.KeyPress, scoreTextBox3.KeyPress
'allow only letters and the Backspace key
If e.KeyChar Like "[!0-9.]" AndAlso
e.KeyChar <> ControlChars.Back Then
e.Handled = True
End If
End Sub
Private Sub scoreTextBox_TextChanged(sender As Object, e As EventArgs) Handles scoreTextBox.TextChanged, scoreTextBox2.TextChanged, scoreTextBox3.TextChanged
If String.IsNullOrWhiteSpace(DirectCast(sender, TextBox).Text) Then
addButton.Enabled = False
Else
addButton.Enabled = True
End If
End Sub
Private Sub saveButton_Click(sender As Object, e As EventArgs) Handles saveButton.Click
Dim outfile As IO.StreamWriter
Dim i As Integer
outfile = IO.File.CreateText("grades.txt, true")
For i = 0 To listBox.Items.Count - 1
outfile.WriteLine(listBox.Items.Item(i))
Next
outfile.WriteLine(averageLabel.Text)
outfile.Close()
End Sub
End Class
Private Sub MainForm_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing
Dim button As DialogResult
button = MessageBox.Show("Do you want to exit? Make sure you exported the file!",
"Exit Verification", MessageBoxButtons.YesNo,
MessageBoxIcon.Exclamation,
MessageBoxDefaultButton.Button2)
If button = DialogResult.No Then
e.Cancel = True
End If
End Sub
Private Sub MainForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
addButton.Enabled = False
saveButton.Enabled = False
'Filling the curve box
curveTextBox.Items.Add("1")
curveTextBox.Items.Add("2")
curveTextBox.Items.Add("3")
curveTextBox.Items.Add("4")
curveTextBox.Items.Add("5")
curveTextBox.SelectedIndex = 0
End Sub
Private Sub scoreTextBox_GotFocus(sender As Object, e As EventArgs) Handles scoreTextBox.GotFocus
scoreTextBox.SelectAll()
End Sub
Private Sub scoreTextBox2_GotFocus(sender As Object, e As EventArgs) Handles scoreTextBox2.GotFocus
scoreTextBox2.SelectAll()
End Sub
If score3 > 100 Then
MessageBox.Show("Test score above 100, please enter your scores again", "Kent State University",
MessageBoxButtons.OK, MessageBoxIcon.Stop,
MessageBoxDefaultButton.Button1)
scoreTextBox.Clear()
scoreTextBox2.Clear()
scoreTextBox3.Clear()
Exit Sub
End If
If scoreTextBox.Text = "" OrElse scoreTextBox2.Text = "" OrElse scoreTextBox3.Text = "" Then
MessageBox.Show("Please re-enter your numbers between 0 and 100 in the textboxs below", "Kent State University",
MessageBoxButtons.OK, MessageBoxIcon.Stop,
MessageBoxDefaultButton.Button1)
scoreTextBox.Clear()
scoreTextBox2.Clear()
scoreTextBox3.Clear()
Exit Sub
End If
For i As Integer = 0 To total.Length - 1
If i = 0 Then
total(i) = score + curve
listBox.Items.Add(total(i))
End If
If i = 1 Then
total(i) = score2 + curve
listBox.Items.Add(total(i))
End If
If i = 2 Then
total(i) = score3 + curve
listBox.Items.Add(total(i))
End If
Next i
listNumber = listBox.Items.Count
If listNumber = 3 Then
addButton.Enabled = False
For Each j As Integer In total
totalAllInteger += j
Next
saveButton.Enabled = True
finalAverage = totalAllInteger / 3
finalAverage = Math.Round(finalAverage, 2)
averageLabel.Text = Convert.ToString(finalAverage)
End If
End Sub
' Project name: Tax Project
' Project purpose: Displays a sales tax amount
' Created/revised by: on
Option Explicit On
Option Strict On
Option Infer Off
Public Class MainForm
Private Sub addButton_Click(sender As Object, e As EventArgs) Handles addButton.Click
Dim score As Double
Dim score2 As Double
Dim score3 As Double
Dim curve As Integer
Dim total(2) As Double
Dim totalAllInteger As Double = 0
Dim finalAverage As Double
Dim listNumber As Double
Double.TryParse(scoreTextBox.Text, score)
Double.TryParse(scoreTextBox2.Text, score2)
Double.TryParse(scoreTextBox3.Text, score3)
curve = Convert.ToInt32(curveTextBox.SelectedItem)
listBox.Items.Clear()
saveButton.Enabled = False
If score > 100 Then
MessageBox.Show("Test score above 100, please enter your scores again", "Kent State University",
MessageBoxButtons.OK, MessageBoxIcon.Stop,
MessageBoxDefaultButton.Button1)
scoreTextBox.Clear()
scoreTextBox2.Clear()
scoreTextBox3.Clear()
Exit Sub
End If
If score2 > 100 Then
MessageBox.Show("Test score above 100, please enter your scores again", "Kent State University",
MessageBoxButtons.OK, MessageBoxIcon.Stop,
MessageBoxDefaultButton.Button1)
scoreTextBox.Clear()
scoreTextBox2.Clear()
scoreTextBox3.Clear()
Exit Sub
End If
Na. I am doing it right now. Just wanted someone to do it with me.
Option Explicit On
Option Strict On
Option Infer Off
Public Class MainForm
Private Sub MainForm_Load(sender As Object, e As EventArgs) Handles MyBase.Load
addButton.Enabled = False
saveButton.Enabled = False
'Filling the curve box
curveTextBox.Items.Add("1")
curveTextBox.Items.Add("2")
curveTextBox.Items.Add("3")
curveTextBox.Items.Add("4")
curveTextBox.Items.Add("5")
curveTextBox.SelectedIndex = 0
End Sub
Private Sub scoreTextBox_KeyPress(sender As Object, e As KeyPressEventArgs) Handles scoreTextBox.KeyPress
'allow only letters and the Backspace key
If e.KeyChar Like "[!0-9]" AndAlso
e.KeyChar <> ControlChars.Back Then
e.Handled = True
End If
End Sub
End Class
This sounds like an attempt to make someone do your homework
I don't know Visual Basic.
here is hint:
Private Sub letterTextBox_KeyPress(sender As Object, e As KeyPressEventArgs) Handles letterTextBox.KeyPress
'allow only letters and the Backspace key
If e.KeyChar Like "[!0-9]" AndAlso
e.KeyChar <> ControlChars.Back Then
e.Handled = True
End If
End Sub
deletedover 8 years
english challenge: spell challenge correctly
I will display mine when I finish it