473,387 Members | 1,512 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How to distinguish odd / even numbers and sumthem

Ron
I want to write a program that will accept a number in a textbox for
example 23578 and then in a label will display the sum of the odd and
even number like this...

the textbox containsthe number 23578
the label would say:
Sumof odd number is: 15
Sum of even number is: 10

any ideas?
thanks

Jan 24 '07 #1
17 4583
This sounds like a homework problem? If so, you should really work this out
on your own and not post here. It's really hard to imagine a real world
application wanting to do this, and a real world programmer not knowing how
to accomplish this...

"Ron" <pt*****@yahoo.comwrote in message
news:11*********************@m58g2000cwm.googlegro ups.com...
>I want to write a program that will accept a number in a textbox for
example 23578 and then in a label will display the sum of the odd and
even number like this...

the textbox containsthe number 23578
the label would say:
Sumof odd number is: 15
Sum of even number is: 10

any ideas?
thanks

Jan 24 '07 #2
Plus think "in English" how you would explain step by step to someone how to
do this. Then tell the same to the computer. For example the first step
would be likely to extract each digit for processing (until the total length
is reached), once you have a digit what would you do and so on...

Welcome to programming...

"Marina Levit [MVP]" <ma*****@comcast.neta écrit dans le message de news:
xZ******************************@comcast.com...
This sounds like a homework problem? If so, you should really work this
out on your own and not post here. It's really hard to imagine a real
world application wanting to do this, and a real world programmer not
knowing how to accomplish this...

"Ron" <pt*****@yahoo.comwrote in message
news:11*********************@m58g2000cwm.googlegro ups.com...
>>I want to write a program that will accept a number in a textbox for
example 23578 and then in a label will display the sum of the odd and
even number like this...

the textbox containsthe number 23578
the label would say:
Sumof odd number is: 15
Sum of even number is: 10

any ideas?
thanks


Jan 24 '07 #3
"Ron" <pt*****@yahoo.comschrieb:
>I want to write a program that will accept a number in a textbox for
example 23578 and then in a label will display the sum of the odd and
even number like this...

the textbox containsthe number 23578
the label would say:
Sumof odd number is: 15
Sum of even number is: 10
Check out the 'Mid' function, the 'For' loop, and the 'Mod' statement.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Jan 24 '07 #4
Well that will get him a C- :-)

"Lost" <lo*******@mailinator.comwrote in message
news:45***********************@authen.yellow.readf reenews.net...
"Ron" <pt*****@yahoo.comwrote:
>>I want to write a program that will accept a number in a textbox for
example 23578 and then in a label will display the sum of the odd and
even number like this...

the textbox containsthe number 23578
the label would say:
Sumof odd number is: 15
Sum of even number is: 10

any ideas?
thanks

Dim strNumber As String
Dim strTemp As String
Dim intIndex As Integer
Dim intTotEvens As Integer
Dim intTotOdds As Integer

intTotOdds = 0
intTotEvens = 0
strNumber = Trim(TextBox1.Text) ' contains input, eg 23578
For intIndex = 1 To Len(strNumber)
strTemp = Mid(strNumber, intIndex, 1)
If InStr("02468", strTemp) 0 Then
intTotEvens = intTotEvens + Val(strTemp)
Else
intTotOdds = intTotOdds + Val(strTemp)
End If
Next intIndex
Label1.Text = "Sum of odd numbers is: " + Str(intTotOdds)
Label2.Text = "Sum of even numbers is: " + Str(intTotEvens)

--
Modo vincis, modo peris

Jan 24 '07 #5

In my day, we had the smarts to cheat on our homework assignments in a place
that wasn't 100% public and archived for all history with a search tool
that's accessed daily by billions of people.

Young people these days. Sheesh.

--
Chris Mullins, MCSD.NET, MCPD:Enterprise, MVP C#
http://www.coversant.net/blogs/cmullins

"Ron" <pt*****@yahoo.comwrote in message
news:11*********************@m58g2000cwm.googlegro ups.com...
>I want to write a program that will accept a number in a textbox for
example 23578 and then in a label will display the sum of the odd and
even number like this...

the textbox containsthe number 23578
the label would say:
Sumof odd number is: 15
Sum of even number is: 10

any ideas?
thanks

Jan 25 '07 #6
Dim intTotEvens As Integer
Dim intTotOdds As Integer

Dim strNumber As String = TextBox1.Text.Trim() ' contains input, eg 23578

For intIndex As Integer = 0 To strNumber.Length - 1
Dim strTemp As String = strNumber.SubString(intIndex, 1)
If ("02468").IndexOf(strTemp) >= 0 Then
intTotEvens += Integer.Parse(strTemp)
Else
intTotOdds += Integer.Parse(strTemp)
End If
Next

Label1.Text = "Sum of odd numbers is: " & intTotOdds.ToString()

Label2.Text = "Sum of even numbers is: " & intTotEvens.ToString()

Does that at least get me a C+? :)

This should grade higher:

Dim _evens As Integer
Dim _odds As Integer

For _i As Integer = 0 To TextBox1.Text.Length - 1
Dim _v As Integer = Integer.Parse(TextBox1.Text.SubString(_i, 1))
If _v Mod 2 = 0 Then
_evens += _v
Else
_odds += _v
End If
Next

Label1.Text = "Sum of odd numbers is: " & _odds.ToString()

Label2.Text = "Sum of even numbers is: " & _evens.ToString()
"Tom Leylan" <tl*****@nospam.netwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
Well that will get him a C- :-)

"Lost" <lo*******@mailinator.comwrote in message
news:45***********************@authen.yellow.readf reenews.net...
>"Ron" <pt*****@yahoo.comwrote:
>>>I want to write a program that will accept a number in a textbox for
example 23578 and then in a label will display the sum of the odd and
even number like this...

the textbox containsthe number 23578
the label would say:
Sumof odd number is: 15
Sum of even number is: 10

any ideas?
thanks

Dim strNumber As String
Dim strTemp As String
Dim intIndex As Integer
Dim intTotEvens As Integer
Dim intTotOdds As Integer

intTotOdds = 0
intTotEvens = 0
strNumber = Trim(TextBox1.Text) ' contains input, eg 23578
For intIndex = 1 To Len(strNumber)
strTemp = Mid(strNumber, intIndex, 1)
If InStr("02468", strTemp) 0 Then
intTotEvens = intTotEvens + Val(strTemp)
Else
intTotOdds = intTotOdds + Val(strTemp)
End If
Next intIndex
Label1.Text = "Sum of odd numbers is: " + Str(intTotOdds)
Label2.Text = "Sum of even numbers is: " + Str(intTotEvens)

--
Modo vincis, modo peris


Jan 25 '07 #7
I guess I sort of stuck my foot in my mouth on that one... now I have to
post something :-) Glad "Lost" took it with humor. What I love about these
homework assignments is that they create small topics from which solutions
can be discussed. Questions like "how do I write a video game" isn't quite
going to be solved by each of us submitting our collision detection routine.

I'd suggest a couple of things. First the routine should be written
independently of the source of input so I wouldn't grab the data out of the
textbox but would require that to be passed to the routine. I opted to
display the values directly into the labels though. The reason is the extra
code needed to initialize them (outside of the routine) and to pass them by
reference just obfuscates things (since (I doubt) this is going to be part
of a reusable library.)

The other was testing the characters as "strings" is problematic. The
solutions tended to insist if a character wasn't "0,2,4,6 or 8" then it must
have been "1,3,5,7 or 9" and I don't know the user didn't key in
"ab383994*0".

I decided to add some functionality that I might be able to use in the
future by creating IsEven() and IsOdd() functions. While not necessary I'd
hate to write ((value MOD 2) = 0 ) the next time I needed to know. Uh,
let's see I opted for the Int32 declaration (not trying to start a fight but
I prefer it too). And I used TryParse so I can determine when non-digits
were entered and I can ignore them.

So here is mine:

' upon some click event or something
ValueCounter(txtInput.Text.Trim())
Private Sub Test7(ByVal sInput As String)

Dim nEvens As Int32 = 0
Dim nOdds As Int32 = 0

Dim bIsDigit As Boolean
Dim nValue As Int32 = 0

For i As Integer = 0 To (sInput.Length - 1)
bIsDigit = Int32.TryParse(sInput.Substring(i, 1), nValue)
If bIsDigit Then
If IsEven(nValue) Then
nEvens += nValue
ElseIf IsOdd(nValue) Then
nOdds += nValue
End If
End If
Next

lblEven.Text = "Sum of even numbers is: " + nEvens.ToString()
lblOdd.Text = "Sum of odd numbers is: " + nOdds.ToString()

End Sub

Public Function IsEven(ByVal num As Int32) As Boolean
Return ((num Mod 2) = 0)
End Function

Public Function IsOdd(ByVal num As Int32) As Boolean
Return (Not IsEven(num))
End Function

"Stephany Young" <noone@localhostwrote in message
news:us*************@TK2MSFTNGP06.phx.gbl...
Dim intTotEvens As Integer
Dim intTotOdds As Integer

Dim strNumber As String = TextBox1.Text.Trim() ' contains input, eg 23578

For intIndex As Integer = 0 To strNumber.Length - 1
Dim strTemp As String = strNumber.SubString(intIndex, 1)
If ("02468").IndexOf(strTemp) >= 0 Then
intTotEvens += Integer.Parse(strTemp)
Else
intTotOdds += Integer.Parse(strTemp)
End If
Next

Label1.Text = "Sum of odd numbers is: " & intTotOdds.ToString()

Label2.Text = "Sum of even numbers is: " & intTotEvens.ToString()

Does that at least get me a C+? :)

This should grade higher:

Dim _evens As Integer
Dim _odds As Integer

For _i As Integer = 0 To TextBox1.Text.Length - 1
Dim _v As Integer = Integer.Parse(TextBox1.Text.SubString(_i, 1))
If _v Mod 2 = 0 Then
_evens += _v
Else
_odds += _v
End If
Next

Label1.Text = "Sum of odd numbers is: " & _odds.ToString()

Label2.Text = "Sum of even numbers is: " & _evens.ToString()
"Tom Leylan" <tl*****@nospam.netwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>Well that will get him a C- :-)

"Lost" <lo*******@mailinator.comwrote in message
news:45***********************@authen.yellow.read freenews.net...
>>"Ron" <pt*****@yahoo.comwrote:

I want to write a program that will accept a number in a textbox for
example 23578 and then in a label will display the sum of the odd and
even number like this...

the textbox containsthe number 23578
the label would say:
Sumof odd number is: 15
Sum of even number is: 10

any ideas?
thanks

Dim strNumber As String
Dim strTemp As String
Dim intIndex As Integer
Dim intTotEvens As Integer
Dim intTotOdds As Integer

intTotOdds = 0
intTotEvens = 0
strNumber = Trim(TextBox1.Text) ' contains input, eg 23578
For intIndex = 1 To Len(strNumber)
strTemp = Mid(strNumber, intIndex, 1)
If InStr("02468", strTemp) 0 Then
intTotEvens = intTotEvens + Val(strTemp)
Else
intTotOdds = intTotOdds + Val(strTemp)
End If
Next intIndex
Label1.Text = "Sum of odd numbers is: " + Str(intTotOdds)
Label2.Text = "Sum of even numbers is: " + Str(intTotEvens)

--
Modo vincis, modo peris



Jan 25 '07 #8
You're really having fun today Tom! ;)

Shouldn't it be:

' upon some click event or something
Test7(txtInput.Text.Trim())

But now we're really cooking with gas:

Dim oae As New OddsAndEvens

If oae.TotalOddsAndEvens(txtInput.Text.Trim()) Then
lblEven.Text = "Sum of even numbers is: " & oae.TotalOfEvens.ToString()
lblOdd.Text = "Sum of odd numbers is: " & oae.TotalOfOdds.ToString()
Else
MessageBox.Show("Supplied value is not a valid value")
End If

Public Class OddsAndEvens

Private m_odds As Int32
Private m_evens As Int32

Public ReadOnly Property TotalOfOdds() As Int32
Get
Return m_odds
End Get
End Property

Public ReadOnly Property TotalOfEvens() As Int32
Get
Return m_evens
End Get
End Property

Public Function TotalOddsAndEvens(value As String) As Boolean

m_odds = 0
m_evens = 0

Dim nValue As Int32 = 0

For i As Integer = 0 To value.Length - 1
If Int32.TryParse(sInput.Substring(i, 1), nValue)
If IsEven(nValue) Then
nEvens += nValue
ElseIf IsOdd(nValue) Then
nOdds += nValue
End If
Else
Return False
End If
Next

Return False

End Sub

Public Shared Function IsEven(ByVal num As Int32) As Boolean
Return (num Mod 2 = 0)
End Function

Public Shared Function IsOdd(ByVal num As Int32) As Boolean
Return (Not IsEven(num))
End Function

End Class
"Tom Leylan" <tl*****@nospam.netwrote in message
news:er**************@TK2MSFTNGP05.phx.gbl...
>I guess I sort of stuck my foot in my mouth on that one... now I have to
post something :-) Glad "Lost" took it with humor. What I love about
these homework assignments is that they create small topics from which
solutions can be discussed. Questions like "how do I write a video game"
isn't quite going to be solved by each of us submitting our collision
detection routine.

I'd suggest a couple of things. First the routine should be written
independently of the source of input so I wouldn't grab the data out of
the textbox but would require that to be passed to the routine. I opted
to display the values directly into the labels though. The reason is the
extra code needed to initialize them (outside of the routine) and to pass
them by reference just obfuscates things (since (I doubt) this is going to
be part of a reusable library.)

The other was testing the characters as "strings" is problematic. The
solutions tended to insist if a character wasn't "0,2,4,6 or 8" then it
must have been "1,3,5,7 or 9" and I don't know the user didn't key in
"ab383994*0".

I decided to add some functionality that I might be able to use in the
future by creating IsEven() and IsOdd() functions. While not necessary
I'd hate to write ((value MOD 2) = 0 ) the next time I needed to know.
Uh, let's see I opted for the Int32 declaration (not trying to start a
fight but I prefer it too). And I used TryParse so I can determine when
non-digits were entered and I can ignore them.

So here is mine:

' upon some click event or something
ValueCounter(txtInput.Text.Trim())
Private Sub Test7(ByVal sInput As String)

Dim nEvens As Int32 = 0
Dim nOdds As Int32 = 0

Dim bIsDigit As Boolean
Dim nValue As Int32 = 0

For i As Integer = 0 To (sInput.Length - 1)
bIsDigit = Int32.TryParse(sInput.Substring(i, 1), nValue)
If bIsDigit Then
If IsEven(nValue) Then
nEvens += nValue
ElseIf IsOdd(nValue) Then
nOdds += nValue
End If
End If
Next

lblEven.Text = "Sum of even numbers is: " + nEvens.ToString()
lblOdd.Text = "Sum of odd numbers is: " + nOdds.ToString()

End Sub

Public Function IsEven(ByVal num As Int32) As Boolean
Return ((num Mod 2) = 0)
End Function

Public Function IsOdd(ByVal num As Int32) As Boolean
Return (Not IsEven(num))
End Function

"Stephany Young" <noone@localhostwrote in message
news:us*************@TK2MSFTNGP06.phx.gbl...
> Dim intTotEvens As Integer
Dim intTotOdds As Integer

Dim strNumber As String = TextBox1.Text.Trim() ' contains input, eg
23578

For intIndex As Integer = 0 To strNumber.Length - 1
Dim strTemp As String = strNumber.SubString(intIndex, 1)
If ("02468").IndexOf(strTemp) >= 0 Then
intTotEvens += Integer.Parse(strTemp)
Else
intTotOdds += Integer.Parse(strTemp)
End If
Next

Label1.Text = "Sum of odd numbers is: " & intTotOdds.ToString()

Label2.Text = "Sum of even numbers is: " & intTotEvens.ToString()

Does that at least get me a C+? :)

This should grade higher:

Dim _evens As Integer
Dim _odds As Integer

For _i As Integer = 0 To TextBox1.Text.Length - 1
Dim _v As Integer = Integer.Parse(TextBox1.Text.SubString(_i, 1))
If _v Mod 2 = 0 Then
_evens += _v
Else
_odds += _v
End If
Next

Label1.Text = "Sum of odd numbers is: " & _odds.ToString()

Label2.Text = "Sum of even numbers is: " & _evens.ToString()
"Tom Leylan" <tl*****@nospam.netwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>>Well that will get him a C- :-)

"Lost" <lo*******@mailinator.comwrote in message
news:45***********************@authen.yellow.rea dfreenews.net...
"Ron" <pt*****@yahoo.comwrote:

>I want to write a program that will accept a number in a textbox for
>example 23578 and then in a label will display the sum of the odd and
>even number like this...
>
>the textbox containsthe number 23578
>the label would say:
>Sumof odd number is: 15
>Sum of even number is: 10
>
>any ideas?
>thanks

Dim strNumber As String
Dim strTemp As String
Dim intIndex As Integer
Dim intTotEvens As Integer
Dim intTotOdds As Integer

intTotOdds = 0
intTotEvens = 0
strNumber = Trim(TextBox1.Text) ' contains input, eg 23578
For intIndex = 1 To Len(strNumber)
strTemp = Mid(strNumber, intIndex, 1)
If InStr("02468", strTemp) 0 Then
intTotEvens = intTotEvens + Val(strTemp)
Else
intTotOdds = intTotOdds + Val(strTemp)
End If
Next intIndex
Label1.Text = "Sum of odd numbers is: " + Str(intTotOdds)
Label2.Text = "Sum of even numbers is: " + Str(intTotEvens)

--
Modo vincis, modo peris




Jan 25 '07 #9
I see I forgot to edit my function call... in my test routines I named it
Test7() but I renamed the thing as I posted. And yes I like it as a class.

Is something up with the TotalOddsAndEvens method? It's returning False all
the time and I'm not sure that a non-digit in the string should make it
fail. And since the class is named OddsAndEvens I might suggest "Total()"
is a good enough name for the method.

And this is why I like these simple examples. Note how you grouped the
private variables at the top of the class? It is a very common style and
used in many books, probably in the MS docs as well. I long ago stopped
doing this and opted for a style which came out of Delphi as I recall.

I declare the private instance variable and then the property. That way I
can see things on a "per property" basis and easily determine whether I have
remembered to generate the property, if it is public/private and whether it
is read-only. It's only a style but I've grown to love it... so it would
look like this:

Private m_odds As Int32

Public ReadOnly Property TotalOfOdds() As Int32
Get
Return m_odds
End Get
End Property

Private m_evens As Int32

Public ReadOnly Property TotalOfEvens() As Int32
Get
Return m_evens
End Get
End Property

"Stephany Young" <noone@localhostwrote in message
news:uR*************@TK2MSFTNGP02.phx.gbl...
You're really having fun today Tom! ;)

Shouldn't it be:

' upon some click event or something
Test7(txtInput.Text.Trim())

But now we're really cooking with gas:

Dim oae As New OddsAndEvens

If oae.TotalOddsAndEvens(txtInput.Text.Trim()) Then
lblEven.Text = "Sum of even numbers is: " & oae.TotalOfEvens.ToString()
lblOdd.Text = "Sum of odd numbers is: " & oae.TotalOfOdds.ToString()
Else
MessageBox.Show("Supplied value is not a valid value")
End If

Public Class OddsAndEvens

Private m_odds As Int32
Private m_evens As Int32

Public ReadOnly Property TotalOfOdds() As Int32
Get
Return m_odds
End Get
End Property

Public ReadOnly Property TotalOfEvens() As Int32
Get
Return m_evens
End Get
End Property

Public Function TotalOddsAndEvens(value As String) As Boolean

m_odds = 0
m_evens = 0

Dim nValue As Int32 = 0

For i As Integer = 0 To value.Length - 1
If Int32.TryParse(sInput.Substring(i, 1), nValue)
If IsEven(nValue) Then
nEvens += nValue
ElseIf IsOdd(nValue) Then
nOdds += nValue
End If
Else
Return False
End If
Next

Return False

End Sub

Public Shared Function IsEven(ByVal num As Int32) As Boolean
Return (num Mod 2 = 0)
End Function

Public Shared Function IsOdd(ByVal num As Int32) As Boolean
Return (Not IsEven(num))
End Function

End Class
"Tom Leylan" <tl*****@nospam.netwrote in message
news:er**************@TK2MSFTNGP05.phx.gbl...
>>I guess I sort of stuck my foot in my mouth on that one... now I have to
post something :-) Glad "Lost" took it with humor. What I love about
these homework assignments is that they create small topics from which
solutions can be discussed. Questions like "how do I write a video game"
isn't quite going to be solved by each of us submitting our collision
detection routine.

I'd suggest a couple of things. First the routine should be written
independently of the source of input so I wouldn't grab the data out of
the textbox but would require that to be passed to the routine. I opted
to display the values directly into the labels though. The reason is the
extra code needed to initialize them (outside of the routine) and to pass
them by reference just obfuscates things (since (I doubt) this is going
to be part of a reusable library.)

The other was testing the characters as "strings" is problematic. The
solutions tended to insist if a character wasn't "0,2,4,6 or 8" then it
must have been "1,3,5,7 or 9" and I don't know the user didn't key in
"ab383994*0".

I decided to add some functionality that I might be able to use in the
future by creating IsEven() and IsOdd() functions. While not necessary
I'd hate to write ((value MOD 2) = 0 ) the next time I needed to know.
Uh, let's see I opted for the Int32 declaration (not trying to start a
fight but I prefer it too). And I used TryParse so I can determine when
non-digits were entered and I can ignore them.

So here is mine:

' upon some click event or something
ValueCounter(txtInput.Text.Trim())
Private Sub Test7(ByVal sInput As String)

Dim nEvens As Int32 = 0
Dim nOdds As Int32 = 0

Dim bIsDigit As Boolean
Dim nValue As Int32 = 0

For i As Integer = 0 To (sInput.Length - 1)
bIsDigit = Int32.TryParse(sInput.Substring(i, 1), nValue)
If bIsDigit Then
If IsEven(nValue) Then
nEvens += nValue
ElseIf IsOdd(nValue) Then
nOdds += nValue
End If
End If
Next

lblEven.Text = "Sum of even numbers is: " + nEvens.ToString()
lblOdd.Text = "Sum of odd numbers is: " + nOdds.ToString()

End Sub

Public Function IsEven(ByVal num As Int32) As Boolean
Return ((num Mod 2) = 0)
End Function

Public Function IsOdd(ByVal num As Int32) As Boolean
Return (Not IsEven(num))
End Function

"Stephany Young" <noone@localhostwrote in message
news:us*************@TK2MSFTNGP06.phx.gbl...
>> Dim intTotEvens As Integer
Dim intTotOdds As Integer

Dim strNumber As String = TextBox1.Text.Trim() ' contains input, eg
23578

For intIndex As Integer = 0 To strNumber.Length - 1
Dim strTemp As String = strNumber.SubString(intIndex, 1)
If ("02468").IndexOf(strTemp) >= 0 Then
intTotEvens += Integer.Parse(strTemp)
Else
intTotOdds += Integer.Parse(strTemp)
End If
Next

Label1.Text = "Sum of odd numbers is: " & intTotOdds.ToString()

Label2.Text = "Sum of even numbers is: " & intTotEvens.ToString()

Does that at least get me a C+? :)

This should grade higher:

Dim _evens As Integer
Dim _odds As Integer

For _i As Integer = 0 To TextBox1.Text.Length - 1
Dim _v As Integer = Integer.Parse(TextBox1.Text.SubString(_i, 1))
If _v Mod 2 = 0 Then
_evens += _v
Else
_odds += _v
End If
Next

Label1.Text = "Sum of odd numbers is: " & _odds.ToString()

Label2.Text = "Sum of even numbers is: " & _evens.ToString()
"Tom Leylan" <tl*****@nospam.netwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl.. .
Well that will get him a C- :-)

"Lost" <lo*******@mailinator.comwrote in message
news:45***********************@authen.yellow.re adfreenews.net...
"Ron" <pt*****@yahoo.comwrote:
>
>>I want to write a program that will accept a number in a textbox for
>>example 23578 and then in a label will display the sum of the odd and
>>even number like this...
>>
>>the textbox containsthe number 23578
>>the label would say:
>>Sumof odd number is: 15
>>Sum of even number is: 10
>>
>>any ideas?
>>thanks
>
Dim strNumber As String
Dim strTemp As String
Dim intIndex As Integer
Dim intTotEvens As Integer
Dim intTotOdds As Integer
>
intTotOdds = 0
intTotEvens = 0
strNumber = Trim(TextBox1.Text) ' contains input, eg 23578
For intIndex = 1 To Len(strNumber)
strTemp = Mid(strNumber, intIndex, 1)
If InStr("02468", strTemp) 0 Then
intTotEvens = intTotEvens + Val(strTemp)
Else
intTotOdds = intTotOdds + Val(strTemp)
End If
Next intIndex
Label1.Text = "Sum of odd numbers is: " + Str(intTotOdds)
Label2.Text = "Sum of even numbers is: " + Str(intTotEvens)
>
>
>
--
Modo vincis, modo peris




Jan 25 '07 #10
Yes, you're right. The final Return False should be Return True.

Yes, it should fail (return False) if any character cannot be parsed as in
integer. If you supply a value such as 123A456 then that is not a number and
therfore is out of context for the method.

Remember that the OP stated that the user was entering a 'number'.

Of course one could argue that such a function should handle any string that
might represent a number including decimal points, thousands separators,
currency symbols, signs, etc., and, if one was so inclined could easily
expand the functionality to be more 'fuzzy'.

My preference, in a class, is to group the private members so that they are
all in one place.
"Tom Leylan" <tl*****@nospam.netwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>I see I forgot to edit my function call... in my test routines I named it
Test7() but I renamed the thing as I posted. And yes I like it as a class.

Is something up with the TotalOddsAndEvens method? It's returning False
all the time and I'm not sure that a non-digit in the string should make
it fail. And since the class is named OddsAndEvens I might suggest
"Total()" is a good enough name for the method.

And this is why I like these simple examples. Note how you grouped the
private variables at the top of the class? It is a very common style and
used in many books, probably in the MS docs as well. I long ago stopped
doing this and opted for a style which came out of Delphi as I recall.

I declare the private instance variable and then the property. That way I
can see things on a "per property" basis and easily determine whether I
have remembered to generate the property, if it is public/private and
whether it is read-only. It's only a style but I've grown to love it...
so it would look like this:

Private m_odds As Int32

Public ReadOnly Property TotalOfOdds() As Int32
Get
Return m_odds
End Get
End Property

Private m_evens As Int32

Public ReadOnly Property TotalOfEvens() As Int32
Get
Return m_evens
End Get
End Property

"Stephany Young" <noone@localhostwrote in message
news:uR*************@TK2MSFTNGP02.phx.gbl...
>You're really having fun today Tom! ;)

Shouldn't it be:

' upon some click event or something
Test7(txtInput.Text.Trim())

But now we're really cooking with gas:

Dim oae As New OddsAndEvens

If oae.TotalOddsAndEvens(txtInput.Text.Trim()) Then
lblEven.Text = "Sum of even numbers is: " &
oae.TotalOfEvens.ToString()
lblOdd.Text = "Sum of odd numbers is: " & oae.TotalOfOdds.ToString()
Else
MessageBox.Show("Supplied value is not a valid value")
End If

Public Class OddsAndEvens

Private m_odds As Int32
Private m_evens As Int32

Public ReadOnly Property TotalOfOdds() As Int32
Get
Return m_odds
End Get
End Property

Public ReadOnly Property TotalOfEvens() As Int32
Get
Return m_evens
End Get
End Property

Public Function TotalOddsAndEvens(value As String) As Boolean

m_odds = 0
m_evens = 0

Dim nValue As Int32 = 0

For i As Integer = 0 To value.Length - 1
If Int32.TryParse(sInput.Substring(i, 1), nValue)
If IsEven(nValue) Then
nEvens += nValue
ElseIf IsOdd(nValue) Then
nOdds += nValue
End If
Else
Return False
End If
Next

Return False

End Sub

Public Shared Function IsEven(ByVal num As Int32) As Boolean
Return (num Mod 2 = 0)
End Function

Public Shared Function IsOdd(ByVal num As Int32) As Boolean
Return (Not IsEven(num))
End Function

End Class
"Tom Leylan" <tl*****@nospam.netwrote in message
news:er**************@TK2MSFTNGP05.phx.gbl...
>>>I guess I sort of stuck my foot in my mouth on that one... now I have to
post something :-) Glad "Lost" took it with humor. What I love about
these homework assignments is that they create small topics from which
solutions can be discussed. Questions like "how do I write a video game"
isn't quite going to be solved by each of us submitting our collision
detection routine.

I'd suggest a couple of things. First the routine should be written
independently of the source of input so I wouldn't grab the data out of
the textbox but would require that to be passed to the routine. I opted
to display the values directly into the labels though. The reason is
the extra code needed to initialize them (outside of the routine) and to
pass them by reference just obfuscates things (since (I doubt) this is
going to be part of a reusable library.)

The other was testing the characters as "strings" is problematic. The
solutions tended to insist if a character wasn't "0,2,4,6 or 8" then it
must have been "1,3,5,7 or 9" and I don't know the user didn't key in
"ab383994*0".

I decided to add some functionality that I might be able to use in the
future by creating IsEven() and IsOdd() functions. While not necessary
I'd hate to write ((value MOD 2) = 0 ) the next time I needed to know.
Uh, let's see I opted for the Int32 declaration (not trying to start a
fight but I prefer it too). And I used TryParse so I can determine when
non-digits were entered and I can ignore them.

So here is mine:

' upon some click event or something
ValueCounter(txtInput.Text.Trim())
Private Sub Test7(ByVal sInput As String)

Dim nEvens As Int32 = 0
Dim nOdds As Int32 = 0

Dim bIsDigit As Boolean
Dim nValue As Int32 = 0

For i As Integer = 0 To (sInput.Length - 1)
bIsDigit = Int32.TryParse(sInput.Substring(i, 1), nValue)
If bIsDigit Then
If IsEven(nValue) Then
nEvens += nValue
ElseIf IsOdd(nValue) Then
nOdds += nValue
End If
End If
Next

lblEven.Text = "Sum of even numbers is: " + nEvens.ToString()
lblOdd.Text = "Sum of odd numbers is: " + nOdds.ToString()

End Sub

Public Function IsEven(ByVal num As Int32) As Boolean
Return ((num Mod 2) = 0)
End Function

Public Function IsOdd(ByVal num As Int32) As Boolean
Return (Not IsEven(num))
End Function

"Stephany Young" <noone@localhostwrote in message
news:us*************@TK2MSFTNGP06.phx.gbl...
Dim intTotEvens As Integer
Dim intTotOdds As Integer

Dim strNumber As String = TextBox1.Text.Trim() ' contains input, eg
23578

For intIndex As Integer = 0 To strNumber.Length - 1
Dim strTemp As String = strNumber.SubString(intIndex, 1)
If ("02468").IndexOf(strTemp) >= 0 Then
intTotEvens += Integer.Parse(strTemp)
Else
intTotOdds += Integer.Parse(strTemp)
End If
Next

Label1.Text = "Sum of odd numbers is: " & intTotOdds.ToString()

Label2.Text = "Sum of even numbers is: " & intTotEvens.ToString()

Does that at least get me a C+? :)

This should grade higher:

Dim _evens As Integer
Dim _odds As Integer

For _i As Integer = 0 To TextBox1.Text.Length - 1
Dim _v As Integer = Integer.Parse(TextBox1.Text.SubString(_i, 1))
If _v Mod 2 = 0 Then
_evens += _v
Else
_odds += _v
End If
Next

Label1.Text = "Sum of odd numbers is: " & _odds.ToString()

Label2.Text = "Sum of even numbers is: " & _evens.ToString()
"Tom Leylan" <tl*****@nospam.netwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl. ..
Well that will get him a C- :-)
>
"Lost" <lo*******@mailinator.comwrote in message
news:45***********************@authen.yellow.r eadfreenews.net...
>"Ron" <pt*****@yahoo.comwrote:
>>
>>>I want to write a program that will accept a number in a textbox for
>>>example 23578 and then in a label will display the sum of the odd and
>>>even number like this...
>>>
>>>the textbox containsthe number 23578
>>>the label would say:
>>>Sumof odd number is: 15
>>>Sum of even number is: 10
>>>
>>>any ideas?
>>>thanks
>>
>Dim strNumber As String
> Dim strTemp As String
> Dim intIndex As Integer
> Dim intTotEvens As Integer
> Dim intTotOdds As Integer
>>
> intTotOdds = 0
> intTotEvens = 0
> strNumber = Trim(TextBox1.Text) ' contains input, eg 23578
> For intIndex = 1 To Len(strNumber)
> strTemp = Mid(strNumber, intIndex, 1)
> If InStr("02468", strTemp) 0 Then
> intTotEvens = intTotEvens + Val(strTemp)
> Else
> intTotOdds = intTotOdds + Val(strTemp)
> End If
> Next intIndex
> Label1.Text = "Sum of odd numbers is: " + Str(intTotOdds)
> Label2.Text = "Sum of even numbers is: " + Str(intTotEvens)
>>
>>
>>
>--
>Modo vincis, modo peris
>
>




Jan 25 '07 #11
Ron
thanks for all of yur posts everone. I am not looking for a way to
cheat on this assignmwent, just for some help. And I found it, the
Trim() was what I was looking for, I was not sure how to divide the
number into its individual numbers.

thanks.
On Jan 24, 10:13 pm, "Stephany Young" <noone@localhostwrote:
Yes, you're right. The final Return False should be Return True.

Yes, it should fail (return False) if any character cannot be parsed as in
integer. If you supply a value such as 123A456 then that is not a number and
therfore is out of context for the method.

Remember that the OP stated that the user was entering a 'number'.

Of course one could argue that such a function should handle any string that
might represent a number including decimal points, thousands separators,
currency symbols, signs, etc., and, if one was so inclined could easily
expand the functionality to be more 'fuzzy'.

My preference, in a class, is to group the private members so that they are
all in one place.

"Tom Leylan" <tley...@nospam.netwrote in messagenews:%2****************@TK2MSFTNGP03.phx.gb l...
I see I forgot to edit my function call... in my test routines I named it
Test7() but I renamed the thing as I posted. And yes I like it as a class.
Is something up with the TotalOddsAndEvens method? It's returning False
all the time and I'm not sure that a non-digit in the string should make
it fail. And since the class is named OddsAndEvens I might suggest
"Total()" is a good enough name for the method.
And this is why I like these simple examples. Note how you grouped the
private variables at the top of the class? It is a very common style and
used in many books, probably in the MS docs as well. I long ago stopped
doing this and opted for a style which came out of Delphi as I recall.
I declare the private instance variable and then the property. That way I
can see things on a "per property" basis and easily determine whether I
have remembered to generate the property, if it is public/private and
whether it is read-only. It's only a style but I've grown to love it...
so it would look like this:
Private m_odds As Int32
Public ReadOnly Property TotalOfOdds() As Int32
Get
Return m_odds
End Get
End Property
Private m_evens As Int32
Public ReadOnly Property TotalOfEvens() As Int32
Get
Return m_evens
End Get
End Property
"Stephany Young" <noone@localhostwrote in message
news:uR*************@TK2MSFTNGP02.phx.gbl...
You're really having fun today Tom! ;)
Shouldn't it be:
' upon some click event or something
Test7(txtInput.Text.Trim())
But now we're really cooking with gas:
Dim oae As New OddsAndEvens
If oae.TotalOddsAndEvens(txtInput.Text.Trim()) Then
lblEven.Text = "Sum of even numbers is: " &
oae.TotalOfEvens.ToString()
lblOdd.Text = "Sum of odd numbers is: " & oae.TotalOfOdds.ToString()
Else
MessageBox.Show("Supplied value is not a valid value")
End If
Public Class OddsAndEvens
Private m_odds As Int32
Private m_evens As Int32
Public ReadOnly Property TotalOfOdds() As Int32
Get
Return m_odds
End Get
End Property
Public ReadOnly Property TotalOfEvens() As Int32
Get
Return m_evens
End Get
End Property
Public Function TotalOddsAndEvens(value As String) As Boolean
m_odds = 0
m_evens = 0
Dim nValue As Int32 = 0
For i As Integer = 0 To value.Length - 1
If Int32.TryParse(sInput.Substring(i, 1), nValue)
If IsEven(nValue) Then
nEvens += nValue
ElseIf IsOdd(nValue) Then
nOdds += nValue
End If
Else
Return False
End If
Next
Return False
End Sub
Public Shared Function IsEven(ByVal num As Int32) As Boolean
Return (num Mod 2 = 0)
End Function
Public Shared Function IsOdd(ByVal num As Int32) As Boolean
Return (Not IsEven(num))
End Function
End Class
"Tom Leylan" <tley...@nospam.netwrote in message
news:er**************@TK2MSFTNGP05.phx.gbl...
I guess I sort of stuck my foot in my mouth on that one... now I have to
post something :-) Glad "Lost" took it with humor. What I love about
these homework assignments is that they create small topics from which
solutions can be discussed. Questions like "how do I write a video game"
isn't quite going to be solved by each of us submitting our collision
detection routine.
>I'd suggest a couple of things. First the routine should be written
independently of the source of input so I wouldn't grab the data out of
the textbox but would require that to be passed to the routine. I opted
to display the values directly into the labels though. The reason is
the extra code needed to initialize them (outside of the routine) and to
pass them by reference just obfuscates things (since (I doubt) this is
going to be part of a reusable library.)
>The other was testing the characters as "strings" is problematic. The
solutions tended to insist if a character wasn't "0,2,4,6 or 8" then it
must have been "1,3,5,7 or 9" and I don't know the user didn't key in
"ab383994*0".
>I decided to add some functionality that I might be able to use in the
future by creating IsEven() and IsOdd() functions. While not necessary
I'd hate to write ((value MOD 2) = 0 ) the next time I needed to know.
Uh, let's see I opted for the Int32 declaration (not trying to start a
fight but I prefer it too). And I used TryParse so I can determine when
non-digits were entered and I can ignore them.
>So here is mine:
> ' upon some click event or something
ValueCounter(txtInput.Text.Trim())
> Private Sub Test7(ByVal sInput As String)
> Dim nEvens As Int32 = 0
Dim nOdds As Int32 = 0
> Dim bIsDigit As Boolean
Dim nValue As Int32 = 0
> For i As Integer = 0 To (sInput.Length - 1)
bIsDigit = Int32.TryParse(sInput.Substring(i, 1), nValue)
If bIsDigit Then
If IsEven(nValue) Then
nEvens += nValue
ElseIf IsOdd(nValue) Then
nOdds += nValue
End If
End If
Next
> lblEven.Text = "Sum of even numbers is: " + nEvens.ToString()
lblOdd.Text = "Sum of odd numbers is: " + nOdds.ToString()
> End Sub
> Public Function IsEven(ByVal num As Int32) As Boolean
Return ((num Mod 2) = 0)
End Function
> Public Function IsOdd(ByVal num As Int32) As Boolean
Return (Not IsEven(num))
End Function
>"Stephany Young" <noone@localhostwrote in message
news:us*************@TK2MSFTNGP06.phx.gbl...
Dim intTotEvens As Integer
Dim intTotOdds As Integer
>> Dim strNumber As String = TextBox1.Text.Trim() ' contains input, eg
23578
>> For intIndex As Integer = 0 To strNumber.Length - 1
Dim strTemp As String = strNumber.SubString(intIndex, 1)
If ("02468").IndexOf(strTemp) >= 0 Then
intTotEvens += Integer.Parse(strTemp)
Else
intTotOdds += Integer.Parse(strTemp)
End If
Next
>> Label1.Text = "Sum of odd numbers is: " & intTotOdds.ToString()
>> Label2.Text = "Sum of even numbers is: " & intTotEvens.ToString()
>>Does that at least get me a C+? :)
>>This should grade higher:
>> Dim _evens As Integer
Dim _odds As Integer
>> For _i As Integer = 0 To TextBox1.Text.Length - 1
Dim _v As Integer = Integer.Parse(TextBox1.Text.SubString(_i, 1))
If _v Mod 2 = 0 Then
_evens += _v
Else
_odds += _v
End If
Next
>> Label1.Text = "Sum of odd numbers is: " & _odds.ToString()
>> Label2.Text = "Sum of even numbers is: " & _evens.ToString()
>>"Tom Leylan" <tley...@nospam.netwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl. ..
Well that will get him a C- :-)
>>>"Lost" <lostag...@mailinator.comwrote in message
news:45***********************@authen.yellow.r eadfreenews.net...
"Ron" <pts4...@yahoo.comwrote:
>>>>>>I want to write a program that will accept a number in a textbox for
>>example 23578 and then in a label will display the sum of the odd and
>>even number like this...
>>>>>>the textbox containsthe number 23578
>>the label would say:
>>Sumof odd number is: 15
>>Sum of even number is: 10
>>>>>>any ideas?
>>thanks
>>>>Dim strNumber As String
Dim strTemp As String
Dim intIndex As Integer
Dim intTotEvens As Integer
Dim intTotOdds As Integer
>>>> intTotOdds = 0
intTotEvens = 0
strNumber = Trim(TextBox1.Text) ' contains input, eg 23578
For intIndex = 1 To Len(strNumber)
strTemp = Mid(strNumber, intIndex, 1)
If InStr("02468", strTemp) 0 Then
intTotEvens = intTotEvens + Val(strTemp)
Else
intTotOdds = intTotOdds + Val(strTemp)
End If
Next intIndex
Label1.Text = "Sum of odd numbers is: " + Str(intTotOdds)
Label2.Text = "Sum of even numbers is: " + Str(intTotEvens)
>>>>--
Modo vincis, modo peris- Hide quoted text -- Show quoted text -
Jan 25 '07 #12
Well Ron... as you know from reading the docs (I kid, I kid) the Trim()
isn't likely to have any affect whatsoever in 99% of the cases. The user
would have to type in leading or trailing spaces for it to make any impact
at all. I do it as a habit to simply shorten the loop and imbedded blanks
would remain.

If you're really not looking for the code to be written for you then one
alternative is to actually post your code and get it reviewed. And if
really want to know how to program then I'll suggest that when you're
assigned 1 programming assignment you undertake to write 10 programs.
"Ron" <pt*****@yahoo.comwrote in message
news:11**********************@s48g2000cws.googlegr oups.com...
thanks for all of yur posts everone. I am not looking for a way to
cheat on this assignmwent, just for some help. And I found it, the
Trim() was what I was looking for, I was not sure how to divide the
number into its individual numbers.

thanks.

Jan 25 '07 #13
"Stephany Young" <noone@localhostwrote in message
news:%2****************@TK2MSFTNGP06.phx.gbl...
My preference, in a class, is to group the private members so that they
are all in one place.
It's the de facto standard and I used to group them as well. But I found
myself having to scroll through the code to find the property itself and had
to work to keep the properties in the same order as the member declarations.
Now I don't. Additionally it should prove useful when dealing with partial
classes.

In any case you (or others) may consider trying it out on a class or two.
If it doesn't work for you don't use it.

Tom
Jan 25 '07 #14

"Stephany Young" <noone@localhostwrote in message
news:uR*************@TK2MSFTNGP02.phx.gbl...
End Class
But Stephany, since this is just a homework assignment, you can only End
Class when the bell rings!!! :)
Jan 25 '07 #15
Tom,

Thanks for this little bit of code. I've been trying to work out in my own
mind how to create a class.

Bruce

"Tom Leylan" <tl*****@nospam.netwrote in message
news:er**************@TK2MSFTNGP05.phx.gbl...
>I guess I sort of stuck my foot in my mouth on that one... now I have to
post something :-) Glad "Lost" took it with humor. What I love about
these homework assignments is that they create small topics from which
solutions can be discussed. Questions like "how do I write a video game"
isn't quite going to be solved by each of us submitting our collision
detection routine.

I'd suggest a couple of things. First the routine should be written
independently of the source of input so I wouldn't grab the data out of
the textbox but would require that to be passed to the routine. I opted
to display the values directly into the labels though. The reason is the
extra code needed to initialize them (outside of the routine) and to pass
them by reference just obfuscates things (since (I doubt) this is going to
be part of a reusable library.)

The other was testing the characters as "strings" is problematic. The
solutions tended to insist if a character wasn't "0,2,4,6 or 8" then it
must have been "1,3,5,7 or 9" and I don't know the user didn't key in
"ab383994*0".

I decided to add some functionality that I might be able to use in the
future by creating IsEven() and IsOdd() functions. While not necessary
I'd hate to write ((value MOD 2) = 0 ) the next time I needed to know.
Uh, let's see I opted for the Int32 declaration (not trying to start a
fight but I prefer it too). And I used TryParse so I can determine when
non-digits were entered and I can ignore them.

So here is mine:

' upon some click event or something
ValueCounter(txtInput.Text.Trim())
Private Sub Test7(ByVal sInput As String)

Dim nEvens As Int32 = 0
Dim nOdds As Int32 = 0

Dim bIsDigit As Boolean
Dim nValue As Int32 = 0

For i As Integer = 0 To (sInput.Length - 1)
bIsDigit = Int32.TryParse(sInput.Substring(i, 1), nValue)
If bIsDigit Then
If IsEven(nValue) Then
nEvens += nValue
ElseIf IsOdd(nValue) Then
nOdds += nValue
End If
End If
Next

lblEven.Text = "Sum of even numbers is: " + nEvens.ToString()
lblOdd.Text = "Sum of odd numbers is: " + nOdds.ToString()

End Sub

Public Function IsEven(ByVal num As Int32) As Boolean
Return ((num Mod 2) = 0)
End Function

Public Function IsOdd(ByVal num As Int32) As Boolean
Return (Not IsEven(num))
End Function

"Stephany Young" <noone@localhostwrote in message
news:us*************@TK2MSFTNGP06.phx.gbl...
> Dim intTotEvens As Integer
Dim intTotOdds As Integer

Dim strNumber As String = TextBox1.Text.Trim() ' contains input, eg
23578

For intIndex As Integer = 0 To strNumber.Length - 1
Dim strTemp As String = strNumber.SubString(intIndex, 1)
If ("02468").IndexOf(strTemp) >= 0 Then
intTotEvens += Integer.Parse(strTemp)
Else
intTotOdds += Integer.Parse(strTemp)
End If
Next

Label1.Text = "Sum of odd numbers is: " & intTotOdds.ToString()

Label2.Text = "Sum of even numbers is: " & intTotEvens.ToString()

Does that at least get me a C+? :)

This should grade higher:

Dim _evens As Integer
Dim _odds As Integer

For _i As Integer = 0 To TextBox1.Text.Length - 1
Dim _v As Integer = Integer.Parse(TextBox1.Text.SubString(_i, 1))
If _v Mod 2 = 0 Then
_evens += _v
Else
_odds += _v
End If
Next

Label1.Text = "Sum of odd numbers is: " & _odds.ToString()

Label2.Text = "Sum of even numbers is: " & _evens.ToString()
"Tom Leylan" <tl*****@nospam.netwrote in message
news:%2****************@TK2MSFTNGP03.phx.gbl...
>>Well that will get him a C- :-)

"Lost" <lo*******@mailinator.comwrote in message
news:45***********************@authen.yellow.rea dfreenews.net...
"Ron" <pt*****@yahoo.comwrote:

>I want to write a program that will accept a number in a textbox for
>example 23578 and then in a label will display the sum of the odd and
>even number like this...
>
>the textbox containsthe number 23578
>the label would say:
>Sumof odd number is: 15
>Sum of even number is: 10
>
>any ideas?
>thanks

Dim strNumber As String
Dim strTemp As String
Dim intIndex As Integer
Dim intTotEvens As Integer
Dim intTotOdds As Integer

intTotOdds = 0
intTotEvens = 0
strNumber = Trim(TextBox1.Text) ' contains input, eg 23578
For intIndex = 1 To Len(strNumber)
strTemp = Mid(strNumber, intIndex, 1)
If InStr("02468", strTemp) 0 Then
intTotEvens = intTotEvens + Val(strTemp)
Else
intTotOdds = intTotOdds + Val(strTemp)
End If
Next intIndex
Label1.Text = "Sum of odd numbers is: " + Str(intTotOdds)
Label2.Text = "Sum of even numbers is: " + Str(intTotEvens)

--
Modo vincis, modo peris




Jan 25 '07 #16
But only my husband gets to ring my bell ;)
"Bruce W. Darby" <kr******@atcomcast.netwrote in message
news:oM******************************@comcast.com. ..
>
"Stephany Young" <noone@localhostwrote in message
news:uR*************@TK2MSFTNGP02.phx.gbl...
> End Class

But Stephany, since this is just a homework assignment, you can only End
Class when the bell rings!!! :)

Jan 25 '07 #17
BTW,

The help you provided me with my little program for work was greatly
appreciated. It allowed me to advance that project to the point where I was
able to use it at work to show the techs that they don't have to
individually compress all those folders. During the compression, the
interface was non-responsive, however, so I'm going to be trying to put the
compression portion of the module into a thread of it's own. I'm kinda
nervous, but I'm trying to work out a way to use the BackgroundWorker, so
I'll probably be back asking questions again soon. :)

Thanks all,
Bruce
"Stephany Young" <noone@localhostwrote in message
news:eE**************@TK2MSFTNGP03.phx.gbl...
But only my husband gets to ring my bell ;)
"Bruce W. Darby" <kr******@atcomcast.netwrote in message
news:oM******************************@comcast.com. ..
>>
"Stephany Young" <noone@localhostwrote in message
news:uR*************@TK2MSFTNGP02.phx.gbl...
>> End Class

But Stephany, since this is just a homework assignment, you can only End
Class when the bell rings!!! :)


Jan 25 '07 #18

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Jon Maz | last post by:
Hi there, I am experimenting with the FileSystemWatcher object. I have set the NotifyFilter as follows: myFileSystemWatcher.NotifyFilter = NotifyFilters.Security | NotifyFilters.CreationTime...
13
by: Dennis C. Drumm | last post by:
How can I tell programmatically if an application is running on a server or workstation, e.g. windows 2000 server or windows 2000 professional for example? Thanks, Dennis
4
by: amit | last post by:
Hi guys!I am trying to write a program which will segregate some selected keywords from a given file.The source code is given alongwith #include<stdio.h> #include<string.h> char...
1
sonic
by: sonic | last post by:
During input validation, how would one decipher between even and odd numbers? I have to write a program that allows an individual to select numbers between 2-14, excluding odds. Here is a snippet...
2
by: cmeekeen | last post by:
How do I square the numbers in the even rows? I have generated 100 integer random numbers in the range of 1 to 100 in array x(10,10). Private Sub Form_Activate() Const row As Integer = 10 Const...
3
by: aksh4u | last post by:
I am prompting the user for name if he/she returns non empty string validate the input string it should contain only alphabets no special characters or numbers else if he/she...
30
by: bdsatish | last post by:
The built-in function round( ) will always "round up", that is 1.5 is rounded to 2.0 and 2.5 is rounded to 3.0. If I want to round to the nearest even, that is my_round(1.5) = 2 # As...
18
by: =?ISO-8859-1?Q?Ney_Andr=E9_de_Mello_Zunino?= | last post by:
Hello. It seems a year is all it takes for one's proficiency in C++ to become too rusty. Professionally, I've been away from the language (and from programming in general), but I still preserve...
3
by: Arndt Jonasson | last post by:
Let's say we have a schema (maybe expressed in XML Schema, but not necessarily so), that allows this instance document: <top> <txt>This is text</txt> <books> <book>Tarzan</book> <book>Harry...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.