Click here to Skip to main content
15,891,607 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Too many Filewatches! Pin
KevinMac27-Apr-07 5:21
KevinMac27-Apr-07 5:21 
GeneralRe: Too many Filewatches! Pin
rudemusik27-Apr-07 15:43
rudemusik27-Apr-07 15:43 
QuestionC# convert problem Pin
Xmen Real 26-Apr-07 15:29
professional Xmen Real 26-Apr-07 15:29 
AnswerRe: C# convert problem Pin
MatrixCoder26-Apr-07 16:05
MatrixCoder26-Apr-07 16:05 
GeneralRe: C# convert problem Pin
Xmen Real 26-Apr-07 16:13
professional Xmen Real 26-Apr-07 16:13 
QuestionAbsolutely URGENT help needed - Collections Pin
new_rez26-Apr-07 13:11
new_rez26-Apr-07 13:11 
AnswerRe: Absolutely URGENT help needed - Collections Pin
Christian Graus26-Apr-07 13:36
protectorChristian Graus26-Apr-07 13:36 
GeneralRe: Absolutely URGENT help needed - Collections Pin
new_rez26-Apr-07 14:19
new_rez26-Apr-07 14:19 
Sorry for my bad post.

Here is my code. The trouble I am having is working out how to find out the amount of odd/even numbers in the array and finding the maximum and the minimum amounts in the array.

'global variables
Dim intNumbers(19) As integer 'array with 10 elements
Dim intCount As Integer 'control the array


Private Sub txtNumbers_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtNumbers.KeyPress
'if not enter - do nothing
If Asc(e.KeyChar) <> 13 Then
Exit Sub
End If

'add one to count
intCount = intCount + 1

'add number entered to the correct array index
intNumbers(intCount) = CDbl(txtNumbers.Text)

txtNumbers.Clear()
txtNumbers.Focus()

'when ten values have been entered - stop input
If intCount = 9 Then
MessageBox.Show("Array full. Please choose next option", "")

lblNumbers.Visible = False
txtNumbers.Visible = False
lstNumbers.Visible = True
btnAdd.Visible = True
btnDisplay.Visible = True
btnStats.Visible = True

End If


End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'set intcount at -1
intCount = -1

End Sub

Private Sub btnAdd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAdd.Click

'add array elements to listbox

For intCount = 1 To 10
lstNumbers.Items.Add(intNumbers(intCount - 1))
Next

End Sub

Private Sub btnDisplay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDisplay.Click
'display the element that the user chooses

intCount = InputBox("Please enter position of number", "", "", 240, 210)

MessageBox.Show("Number at postion " & intCount & _
" is " & intNumbers(intCount - 1), "")

End Sub

Private Sub btnStats_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStats.Click
'declare the total and average of the numbers entered

'variables
Dim dblTotal As Double
Dim dblAverage As Double
'total
For intCount = 0 To 9
dblTotal = dblTotal + intNumbers(intCount)
Next

'average
dblAverage = dblTotal / 10

MessageBox.Show("Your totals are:" & vbCrLf & _
"Total: " & Format(dblTotal, "0.00") & vbCrLf & _
"Average: " & Format(dblAverage, "0.00"))

End Sub


End Class
GeneralRe: Absolutely URGENT help needed - Collections Pin
new_rez26-Apr-07 14:24
new_rez26-Apr-07 14:24 
GeneralRe: Absolutely URGENT help needed - Collections Pin
Christian Graus26-Apr-07 14:36
protectorChristian Graus26-Apr-07 14:36 
GeneralRe: Absolutely URGENT help needed - Collections Pin
new_rez26-Apr-07 14:45
new_rez26-Apr-07 14:45 
GeneralRe: Absolutely URGENT help needed - Collections Pin
Christian Graus26-Apr-07 14:50
protectorChristian Graus26-Apr-07 14:50 
GeneralRe: Absolutely URGENT help needed - Collections Pin
Colin Angus Mackay26-Apr-07 14:25
Colin Angus Mackay26-Apr-07 14:25 
GeneralRe: Absolutely URGENT help needed - Collections Pin
new_rez26-Apr-07 14:27
new_rez26-Apr-07 14:27 
GeneralRe: Absolutely URGENT help needed - Collections Pin
Colin Angus Mackay26-Apr-07 14:33
Colin Angus Mackay26-Apr-07 14:33 
GeneralRe: Absolutely URGENT help needed - Collections Pin
Christian Graus26-Apr-07 14:36
protectorChristian Graus26-Apr-07 14:36 
GeneralRe: Absolutely URGENT help needed - Collections Pin
Christian Graus26-Apr-07 14:33
protectorChristian Graus26-Apr-07 14:33 
GeneralRe: Absolutely URGENT help needed - Collections Pin
Christian Graus26-Apr-07 14:32
protectorChristian Graus26-Apr-07 14:32 
AnswerRe: Absolutely URGENT help needed - Collections Pin
Christian Graus26-Apr-07 14:15
protectorChristian Graus26-Apr-07 14:15 
GeneralRe: Absolutely URGENT help needed - Collections Pin
Colin Angus Mackay26-Apr-07 14:20
Colin Angus Mackay26-Apr-07 14:20 
AnswerRe: Absolutely URGENT help needed - Collections Pin
Colin Angus Mackay26-Apr-07 14:19
Colin Angus Mackay26-Apr-07 14:19 
Questionregular expression Pin
aldo hexosa26-Apr-07 12:50
professionalaldo hexosa26-Apr-07 12:50 
AnswerRe: regular expression Pin
Christian Graus26-Apr-07 13:03
protectorChristian Graus26-Apr-07 13:03 
GeneralRe: regular expression Pin
aldo hexosa1-May-07 3:41
professionalaldo hexosa1-May-07 3:41 
GeneralRe: regular expression Pin
Christian Graus1-May-07 10:37
protectorChristian Graus1-May-07 10:37 

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.