Click here to Skip to main content
15,887,683 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Generalserialization of datagridtablestyle Pin
frush1232-Dec-04 8:18
frush1232-Dec-04 8:18 
GeneralRe: serialization of datagridtablestyle Pin
Tom John3-Dec-04 2:03
Tom John3-Dec-04 2:03 
GeneralRe: serialization of datagridtablestyle Pin
frush1233-Dec-04 2:07
frush1233-Dec-04 2:07 
GeneralRe: serialization of datagridtablestyle Pin
Tom John3-Dec-04 2:41
Tom John3-Dec-04 2:41 
GeneralRe: serialization of datagridtablestyle Pin
frush1233-Dec-04 2:59
frush1233-Dec-04 2:59 
GeneralRe: serialization of datagridtablestyle Pin
Tom John3-Dec-04 3:14
Tom John3-Dec-04 3:14 
GeneralRe: serialization of datagridtablestyle Pin
Anonymous3-Dec-04 12:21
Anonymous3-Dec-04 12:21 
GeneralProblems with code Pin
Tech 4 a dummy2-Dec-04 4:28
Tech 4 a dummy2-Dec-04 4:28 
This is a code to calculate a class average. I am trying to modify the btnAverage_click event handler so that intGraderCounter is incremented until it is equal to the number of grades entered, and by using the 1stGrades.Items.Count to determine the number of items in the listbox. The number returned by the count property will be 0 if there are no grade entered. I need to use and if… then selection statement to avoid division by zero and to display a message dialog to the user if there are no grades entered when the user clicks the Average button. I also need help on modifying the code in the btnAverage_Click event handler so that the dblAverage is computed by using the intGraderCounter rather than the value 10. I tried all sorts of things that I could do but the program is still not running right. The code is below...


' handles Add Grade Button's Click event
Private Sub btnAdd_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnAdd.Click

' clear previous grades and calculation result
If lblOutput.Text <> "" Then
lblOutput.Text = ""
lstGrades.Items.Clear()
End If

' display grade in ListBox
lstGrades.Items.Add(Val(txtInput.Text))
txtInput.Clear() ' clear grade from TextBox
txtInput.Focus() ' transfer focus to TextBox

'' prohibit users from entering more than 10 grades
'If lstGrades.Items.Count >= 10 Then
' btnAdd.Enabled = False ' disable Add Grade Button
' btnAverage.Focus() ' transfer focus to Average Button
'End If

End Sub ' btnAdd_Click

' handles Average Button's Click event
Private Sub btnAverage_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnAverage.Click

' initialization phase
Dim intTotal As Integer = 0
Dim intGradeCounter As Integer = 0
Dim intGrade As Integer = 0
Dim dblAverage As Double = 0

' sum grades in ListBox
Do

' read grade from ListBox
intGrade = lstGrades.Items.Item(intGradeCounter)
intTotal += intGrade ' add grade to total
intGradeCounter += 1 ' increment counter
Loop Until intGradeCounter >= 10

dblAverage = intTotal / 10 ' calculate average
lblOutput.Text = String.Format("{0:F}", dblAverage)
btnAdd.Enabled = True ' enable Add Grade Button
txtInput.Focus() ' reset focus to Enter grade: TextBox
End Sub ' btnAverage_Click

Private Sub FrmClassAverage_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub
End Class ' FrmClassAverage




Need Help!!!!!!!
GeneralRe: Problems with code Pin
The Man from U.N.C.L.E.2-Dec-04 5:28
The Man from U.N.C.L.E.2-Dec-04 5:28 
GeneralRe: Windows Services CPU Usage Problem Pin
Dave Kreskowiak2-Dec-04 1:23
mveDave Kreskowiak2-Dec-04 1:23 
GeneralRe: Windows Services CPU Usage Problem Pin
sayhigh2-Dec-04 14:43
sayhigh2-Dec-04 14:43 
GeneralRe: Windows Services CPU Usage Problem Pin
Dave Kreskowiak2-Dec-04 16:07
mveDave Kreskowiak2-Dec-04 16:07 
QuestionHow to open new form through dll Pin
geekru22-Dec-04 1:03
geekru22-Dec-04 1:03 
AnswerRe: How to open new form through dll Pin
Dave Kreskowiak2-Dec-04 1:31
mveDave Kreskowiak2-Dec-04 1:31 
GeneralWindows Services CPU Usage Problem Pin
sayhigh1-Dec-04 22:31
sayhigh1-Dec-04 22:31 
QuestionHow can i run external application from within .NET Pin
Member 6254861-Dec-04 21:03
Member 6254861-Dec-04 21:03 
AnswerRe: How can i run external application from within .NET Pin
Mekong River2-Dec-04 10:12
Mekong River2-Dec-04 10:12 
GeneralMoving DataGrid Items Pin
Mitch F.1-Dec-04 9:55
Mitch F.1-Dec-04 9:55 
GeneralRe: Moving DataGrid Items Pin
Dave Kreskowiak1-Dec-04 10:49
mveDave Kreskowiak1-Dec-04 10:49 
GeneralRe: Moving DataGrid Items Pin
Mitch F.1-Dec-04 11:47
Mitch F.1-Dec-04 11:47 
GeneralRe: Moving DataGrid Items Pin
Dave Kreskowiak2-Dec-04 1:14
mveDave Kreskowiak2-Dec-04 1:14 
GeneralRe: Moving DataGrid Items Pin
Mitch F.2-Dec-04 8:27
Mitch F.2-Dec-04 8:27 
Generalreflection propertinfo getvalue Pin
Member 3857011-Dec-04 7:37
Member 3857011-Dec-04 7:37 
GeneralRe: reflection propertinfo getvalue Pin
The Man from U.N.C.L.E.2-Dec-04 1:10
The Man from U.N.C.L.E.2-Dec-04 1:10 
GeneralDoes Anyone not know anything about importing databases Pin
Suresh Prasad1-Dec-04 6:40
Suresh Prasad1-Dec-04 6:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.