473,320 Members | 2,052 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,320 software developers and data experts.

topcoder headache

Anyone care to take a stab at why I am unable to send the
array of (2,3,4,5) to the pictureFrames function? This is
for tonights topcoder competition...I was the only VB
programmer in my room again so nobody to compare with.

-Roy
Public Class Form1
Inherits System.Windows.Forms.Form

Private Sub Button2_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Button2.Click

Dim myworkshop As New Workshop()
Dim x As Integer
x = myworkshop.pictureFrames(2,3,4,5)

End Sub
End Class
Public Class Workshop
Dim FirstCount As Integer
Dim SecondCount As Integer
Dim ThirdCount As Integer
Dim lenArray As Integer
Dim x As Integer
Dim y As Integer
Dim z As Integer
Dim Flag As Integer = 0
Dim totalFlags As Integer = 0

Public Function pictureFrames(ByVal pieces As Integer
()) As Integer
lenArray = pieces.Length
For x = 0 To lenArray - 1
FirstCount = pieces(x)
For y = x + 1 To lenArray - 1
SecondCount = pieces(y)
For z = y + 1 To lenArray - 1
ThirdCount = pieces(z)
If FirstCount + SecondCount >
ThirdCount Then
Flag = Flag + 1
End If
If SecondCount + ThirdCount >
FirstCount Then
Flag = Flag + 1
End If
If ThirdCount + FirstCount >
SecondCount Then
Flag = Flag + 1
End If
If Flag = 3 Then totalFlags =
totalFlags + 1

Next
Next
Next
Return totalFlags
End Function
End Class
Nov 20 '05 #1
1 966
"Roy Lawson" <ro*@freedomcast.com> schrieb
Dim myworkshop As New Workshop()
Dim x As Integer
x = myworkshop.pictureFrames(2,3,4,5)
Here you pass 4 Integer values.

Public Function pictureFrames(ByVal pieces As Integer
()) As Integer


Here you expect an Array of Integers.
Solution 1:
x = myworkshop.pictureFrames(New Integer(){2,3,4,5})

Solution 2:
Public Function pictureFrames(ByVal ParamArray pieces As Integer ()) As
Integer

(Keep the call unchanged)
--
Armin

Nov 20 '05 #2

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

Similar topics

0
by: David | last post by:
On every web browser except Safari, this website works great. (Well, by "every" I mean Mozilla, Netscape, and Internet Explorer, for Mac and Windows). The site is: http://www.ruleofthirds.com ...
5
by: Ryan Ternier | last post by:
I'm having an issue with an SQL insert statement. It's a very simple statement, and it's causing too much fuss. strSQL = "INSERT INTO tblFieldLayouts(TypeID, FieldID, OrderID, Hidden) VALUES("...
3
by: laurenq uantrell | last post by:
I'm trying to return an integer from the following table that returns the number of unique cities: tblEmployees Name City John Boston Frank New York Jim Omaha Betty ...
12
by: NuB | last post by:
The validation controls are giving me a headache. here is what i'm trying to do and so far what I've tried has not worked. I need to hide my grid if the page is not valid how can i accomplish...
5
by: James Ma | last post by:
Now I am debugging a buggy VB.NET function like following Function foo() Try ‘ many loops and codes and nested try catch here! …… Catch (ex as Exception) Msgbox ex.message Finally …
3
by: Echo | last post by:
Hi all. Sorry about the crude headline but this problem is really giving me a headache. See I am currently deloping an app in Visual Studios 2005 C# Lanuage and the thing is like this: I have a...
0
by: Gianni Mariani | last post by:
Topcoder is currently running "Marathon Match 4", see here. http://www.topcoder.com/longcontest/?module=ViewStandings&rd=9974 The interesting thing is, they accept 3 languages, C++, Java and...
12
by: Krij | last post by:
Hi! A button on frmOrders will let user return an order. But... The following SQL is giving me a headache: strPutBack = "INSERT INTO tblAmountItems(Amount,MyDate,Returned) " _ & "SELECT...
1
gchq
by: gchq | last post by:
Hi there Attempting to populate a dynamic table with data - that in itself is not a problem, but getting group headers IS giving me a headache. Know I've done this before, but can I remember how?...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.