|
Post by woffan4ever on Mar 10, 2012 16:48:37 GMT -5
Hey guys! Do any of you know anything about Visual Basic? I'm stuck on a homework problem and I don't know what to do! I need any help I can get by Monday. I have half of the problem worked out, I just need help on the last part. Thanks!
|
|
MarioGS
Made It and Played It VIP
PhD in Wheeloffortunology
Posts: 14,931
Airdate: 03/25/2016
Winnings: $76,086
SPIN ID: RS1363545
|
Post by MarioGS on Mar 10, 2012 16:59:35 GMT -5
There's bound to be a similar problem on all those coding forums out there that can help you.
I don't know much about Visual Basic, but I know a bit about C++. What does the problem involve?
|
|
|
Post by Deleted on Mar 10, 2012 18:56:35 GMT -5
I'm pretty good with Visual Basic. You can ask me.
|
|
|
Post by woffan4ever on Mar 10, 2012 19:22:49 GMT -5
Mario, every place that I have looked for help with this problem, but they all want me to pay for an answer. Not gonna happen...here's the problem:
Build a small application that fills a collection (list) with 10 sequential numbers, and then prints the collection(list) in reverse order, skipping every other member, until the entire collection has been displayed. For example, if the collection contained the numbers 1 through 10, they would print as:
10, 8, 6, 4, 2, 9, 7, 5, 3, 1 The print out should be in that order no matter what sequential numbers are in the collection (list). If it were 21 through 30, output would be 30,28,26,24,22,29,27,25,23,21 and so forth.
Note: you must use a collection - do not write down the numbers directly to produce the output. Loops should be employed but the loop control variable should be used as an index or subscript number. Your code should work even if I change the list of sequential numbers to something else. Remember that indexes count from 0 first -- the first item in a collection has index 0, the second item in a collection has index 1, and so forth.
This is what I have done so far:
Option Explicit On Option Strict On Option Infer Off Public Class Form1
Private Sub btnExit_Click(sender As System.Object, e As System.EventArgs) Handles btnExit.Click 'closes the program without error Me.Close() End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'this will put numbers in the list box
For lblOrgList As Double = 1 To 10 lstOrgValues.Items.Add(lblOrgList.ToString) Next lblOrgList
I just need help with the last part. I can't figure out how to get the numbers to go in the text box backwards like they're supposed to! It's driving me nuts!!
|
|
|
Post by Deleted on Mar 10, 2012 19:26:35 GMT -5
can you submit a picture of the form? BTW, under btnExit_click, change "me.close()" to "Application.Exit". Me.close only closes the form it's representing, not the entire program. This is especially useful if you have a program with multiple forms.
|
|
MarioGS
Made It and Played It VIP
PhD in Wheeloffortunology
Posts: 14,931
Airdate: 03/25/2016
Winnings: $76,086
SPIN ID: RS1363545
|
Post by MarioGS on Mar 10, 2012 19:27:10 GMT -5
Oh, my. I'm afraid that style of coding is way different from C++. Hopefully Nick knows.
|
|
|
Post by woffan4ever on Mar 10, 2012 20:10:23 GMT -5
My book instructs us to use "Me.Close()." So, that's why I use it. This is a one form only project. Here's the form: i.imgur.com/Prl4n.pngI need numbers in the list box (not seen here because I was not in debug mode) to appear in the text box to side as "10,8,6,4,2,9,7,5,3,1". For a clearer picture, here's a shot of the actual code:
|
|
|
Post by Deleted on Mar 10, 2012 20:18:40 GMT -5
|
|
|
Post by woffan4ever on Mar 10, 2012 20:49:41 GMT -5
Thanks, Nick! I posted in the VB.NET form on Dream In Code. Most everyone there seems knowledgeable and helpful. I hope to find help soon!
|
|