Click here to Skip to main content
15,898,588 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: How to make multiline textbox to display the last element added or scroll to last? Pin
pallaka28-Oct-09 0:03
pallaka28-Oct-09 0:03 
QuestionUsing Avicap32 for Video Recording Pin
kjsl2k927-Oct-09 20:46
kjsl2k927-Oct-09 20:46 
AnswerRe: Using Avicap32 for Video Recording Pin
Christian Graus27-Oct-09 21:29
protectorChristian Graus27-Oct-09 21:29 
QuestionWeb Application using Visual Studio 2005 & .NET ! Pin
jeshra27927-Oct-09 20:46
jeshra27927-Oct-09 20:46 
AnswerRe: Web Application using Visual Studio 2005 & .NET ! Pin
_Damian S_27-Oct-09 20:55
professional_Damian S_27-Oct-09 20:55 
GeneralRe: Web Application using Visual Studio 2005 & .NET ! Pin
jeshra27927-Oct-09 21:33
jeshra27927-Oct-09 21:33 
GeneralRe: Web Application using Visual Studio 2005 & .NET ! Pin
Christian Graus27-Oct-09 22:10
protectorChristian Graus27-Oct-09 22:10 
QuestionArray Help Pin
PAguilar0927-Oct-09 20:25
PAguilar0927-Oct-09 20:25 
I am currently allowing a user to enter in values into a text box. Then click a button to display the values and find the sum and mean of all the values entered. But i saw a problem when i was testing out the program.

When the user 1st runs the program it works perfecT! but if the user tries to re-enter new values and click the display button again, the sum and mean is added to the previous mean and sum so the values are way off!!! Here is my code I am not sure what I am forgetting to do? I know its something DEALING WITH MY FOR LOOP and COUNTER

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
'*************************************************************************************
'in this subroutine the User will click the save button to save grades to an array and
'then display the data required by the program.
'*************************************************************************************


Str = txtGrades.Text 'store string into variable
strArr = str.Split(" ") 'use split to seperate words by space

For count = 0 To strArr.Length - 1
'add user entered values to list box
lstGrades.Items.Add(strArr(count))
lblGrades.Text = lstGrades.Items.Count
iSum += Convert.ToDouble(strArr(count)) 'get sum of values entered and pass to storing variable
lblSum.Text = iSum 'display sum in label box

Next 'end for


dFAvg = Convert.ToDouble(lblSum.Text) / Convert.ToDouble(lblGrades.Text) 'calculate average
lblAvg.Text = FormatNumber(dFAvg, 2) 'display average after storing calculation in variable, format to display only 2 decimal places
lblStdDev.Text = STD


End Sub

'this is the subroutine for my clear text box
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
'********************************************************************8
'this subroutine will simply clear out the text box containing the user entered data
'as well as the lstbox displaying all the values entered
'and allow him/her to enter in new data

txtGrades.Text = ""
lblGrades.Text = ""
lblSum.Text = ""
lblAvg.Text = ""

lstGrades.Items.Clear()
txtGrades.Focus()


End Sub
AnswerRe: Array Help Pin
tosch27-Oct-09 20:38
tosch27-Oct-09 20:38 
GeneralRe: Array Help Pin
PAguilar0927-Oct-09 20:44
PAguilar0927-Oct-09 20:44 
AnswerRe: Array Help Pin
_Damian S_27-Oct-09 20:59
professional_Damian S_27-Oct-09 20:59 
GeneralRe: Array Help Pin
PAguilar0927-Oct-09 21:08
PAguilar0927-Oct-09 21:08 
QuestionError while read Text File Pin
Anubhava Dimri27-Oct-09 20:04
Anubhava Dimri27-Oct-09 20:04 
AnswerRe: Error while read Text File Pin
Christian Graus27-Oct-09 21:31
protectorChristian Graus27-Oct-09 21:31 
GeneralRe: Error while read Text File Pin
Anubhava Dimri27-Oct-09 22:57
Anubhava Dimri27-Oct-09 22:57 
GeneralRe: Error while read Text File Pin
Christian Graus27-Oct-09 23:51
protectorChristian Graus27-Oct-09 23:51 
QuestionMy Application Issue. Pin
Nanda_MR27-Oct-09 18:57
Nanda_MR27-Oct-09 18:57 
AnswerRe: My Application Issue. Pin
Christian Graus27-Oct-09 19:46
protectorChristian Graus27-Oct-09 19:46 
GeneralRe: My Application Issue. Pin
Nanda_MR27-Oct-09 19:59
Nanda_MR27-Oct-09 19:59 
GeneralRe: My Application Issue. Pin
Christian Graus27-Oct-09 21:32
protectorChristian Graus27-Oct-09 21:32 
GeneralRe: My Application Issue. Pin
Nanda_MR27-Oct-09 22:30
Nanda_MR27-Oct-09 22:30 
QuestionVB.Net code wont ework propertly under certain account conditions Pin
Martin Stevens27-Oct-09 17:34
Martin Stevens27-Oct-09 17:34 
AnswerRe: VB.Net code wont ework propertly under certain account conditions Pin
Luc Pattyn27-Oct-09 18:58
sitebuilderLuc Pattyn27-Oct-09 18:58 
GeneralRe: VB.Net code wont ework propertly under certain account conditions Pin
Martin Stevens27-Oct-09 20:33
Martin Stevens27-Oct-09 20:33 
AnswerRe: VB.Net code wont ework propertly under certain account conditions Pin
Dave Kreskowiak28-Oct-09 4:02
mveDave Kreskowiak28-Oct-09 4:02 

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.