VS 2008 - Looping Structures For Class

Dec 14, 2009

I have this Visual Basic class I'm taking online. At this point in the section all I'm supposed to know about are Do, Do While, Do Until, Exit Do, Continue Do, and For Next loops. So try not to go off in a fancy super-coder direction. And everything is (preferably) made through Console Applications on VBE 2008

Problem 1:
Write a program that evaluates the factorials of the integers from 1 to 10 using an appropriate data type. (factorials are... factorial of 1 is 1, factorial of 5 is 120, or 1*2*3*4*5=120)

Problem 2:
Make a diamond - 1 asterisk at the top, 9 asterisks at it's widest - using only nested For...Next statements to print the asterisks AND spaces, minimizing use of output statements.

View 4 Replies


ADVERTISEMENT

Looping Through Properties In A Class?

May 22, 2011

I have this class

Code:
Public Class Customer
Public Property AccountNumber() As String
Public Property AccountCreationDate() As String

[code].....

This works but I tried to loop thru the properties of the class with a For Each/Next loop. It does not work as the intellisense won't co-operate with Items I think i need like "PropertyInfo" . After reading, I see that only thru Reflection can I do this. Well, Reflection has me baffled at the moment.

View 5 Replies

(2005) Arrays Of Structures Within Structures?

Jan 20, 2009

I have a structure called 'Scheme' and in my program I want (ideally) an ArrayList of 'Schemes' (so i can add, remove schemes etc.). However, within the 'Scheme' structure, I want to have an ArrayList of 'Item''Item' is another structure. Are there any solutions out there for iterating through these arrays quite easily?

How can I easily add multiple Items to a Scheme and mutliple Schemes to my Scheme array. Code is below. When I try to add Items to a Scheme, I get the 'Object not set to a reference of an object, try the 'New' keyword', but you cannot declare 'New' keywork within a structure.

[Code]...

View 4 Replies

Structures And Arrays In VB (VS 2008)?

Mar 14, 2010

I would be more that happy for someone to tell me I am missing something very simple here I am writing code that - amongst other things - talks to code on other servers using the tcpclient function in .net

What I want to do is - in essense very simply. I want to define a structure which includes an array load it with data and sent it to the other end of the socket.

[Code]...

View 4 Replies

VS 2008 Passing Structures Between Modules?

Apr 25, 2010

i have a main module called "main", within the module i have declared 2 other modules "Interfacing" and "Espec", within these 2 submodules they both have a structure called "coord" which is identical. The problem is that when i have defined a function in one module with "coord" as type and try to assign a value in the other module with coord type i get error message "Value of type Main.Interfacing.Coord cannot be converted to Main.Espec.Coord", so basically how could i pass that structure?

[Code]...

View 3 Replies

[2008] Running Arrays From Structures?

Feb 16, 2009

i am currently running a program that will allow me to save all data on the form to open and edit at will. It uses a structure of 8 arrays, each with 16 values to save the information.

When i try to save the text into the array, it tells me that its a bad record length and crashes.

Here is the

Public Structure save_weekly
<VBFixedString(8)> Public dates() As String
<VBFixedString(30)> Public description() As String

[Code].....

View 4 Replies

VS 2008 Bubble Sort Array Structures?

Apr 15, 2009

I've learned about and understand HOW to do a bubble sort (theoretically), but I can't seem to wrap my head around how to use a bubble sort with array structures. I'm supposed to be able to sort the inputted student information (via textfile) using bubble sort and display the result in a listbox. Buttons for Sort by last name, sort by gpa, & sort by letter grade.

[Code]...

View 8 Replies

Structures And Arrays Of Structures?

Jun 2, 2010

I read in the Book "Mastering Microsoft Visual Basic 2008" about "User-Defined data types".The example given is creating a Structure as follows.I wanted to check that so I wrote all the code given; I used a TextBox and a Button for this.(I didn't include the "CheckDate" here; that is in the book)

Structure CheckRecord
Dim CheckNumber As Integer

[code]....

The problem is this does work.What I get is "00000". and I found out that the "Checks(4)" Array does hold any value ie: on keeping the cursor over that, it shows "CheckAmount 0.0, CheckNumber 0 , CheckPaidTo Nothing ".

View 1 Replies

VS 2008 Vending Machine Using Structures - Calculate The Change From The Structure

Aug 23, 2009

I'm having a little trouble working with structures and using a counter for the same structure. my structure gets its data from a text file which i readoff and assign ok. Here's part of my code

[Code]....

View 9 Replies

VS 2008 Looping In Datagridview?

Oct 15, 2011

Mine is a windows app. containing forms named BOM nd BOMSelected..There is datagridview in BOM which contains checkbox column.. When the user selects checkbox, the selected rows should be seen in the datagridview of other form, SelectedBom..

[Code]...

View 39 Replies

VS 2008 Looping Through An Object?

Dec 15, 2009

I have been using the following code for quite some time to list the property values of an object:

Dim instance As New Configuration
Dim propValue As Object
For Each pi As System.Reflection.PropertyInfo In instance.GetType.GetProperties()

[Code].....

Works great but we've gotten alot of properties at this point and could use them in alphabetical order.

View 3 Replies

VS 2008 Looping Through Checkboxes

Apr 20, 2009

looping through check boxes.. checkbox1, checkbox2, checkbox3...... Error in the code ocheck = "CheckBox" & Str(t) as "Run time errors may occur when converting 'string' to 'Microsoft.office.interop.word.checkbox'." Dim No_Checkboxes As Integer, ocheck As CheckBox

[Code]...

View 7 Replies

VS 2008 Looping With Textboxs

Sep 8, 2009

I would like to know how to loop with textboxs. For example. I would set the text to "Hello" And the loop will send this...

-"Hello1"
-"Hello2"
-"Hello3"

I have tried many looping techniques but they all used listboxs and even modifying them I could not get it to work correctly.

View 3 Replies

VS 2008 DataReader Error In Looping

Mar 29, 2009

[code]I am facing difficulty in coding when intRow loop for the 2nd round. Error message "There is already an open DataReader associated with this Command which must be closed " appear in the above red highlight vb.net code.

View 6 Replies

VS 2008 Looping For Files In Directory?

Jul 12, 2010

I have some code that should update my listbox with files in a directory i have this code put in a timer:

[Code]...

View 10 Replies

VS 2008 Looping Sending Loopy?

Apr 21, 2009

Have this Uni question; which after 20 minutes of frustration I'm sending it to the brain trust (you might be interested).Write a program that, when a button is pressed, checks the contents of a textbox. If the textbox does not contain a number, the program informs the user of this and does nothing more. Once a number has been entered, the program will do something trivial such as displaying double the number in a message box.Notice that this can be done without explicit looping,even though the user might repeatedly enter non-numbers. Because it is an event-driven program, each iteration is started when the user clicks the button. The looping is driven by the user, not by a looping statement.

View 5 Replies

VS 2008 Looping Through All Rows In A Datagrid?

Jan 11, 2011

Im trying to loop through all rows in a datagrid and enter a calculation in the field in the next column (first column is already populated with appliance names). The code below works but only on the first row. Can someone be good enough to point out my error? For Each row As DataGridViewRow In DataGridView1.Rows

If DataGridView1.Rows(s).Cells(0).Value = "" Then
DataGridView1.Rows(s).Cells(1).Value = "0"
Else
DataGridView1.Rows(s).Cells(1).Value = dtDLopt.Compute("SUM(Measurement)", "Appliance = '" & DataGridView1.Rows(s).Cells(0).Value & "'")
End If
Next row

View 3 Replies

VS 2008 Looping Through All Webcam Sources

Jul 2, 2010

I'm using this code to get the preview window

Dim iHeight As Integer = picCapture.Height
Dim iWidth As Integer = picCapture.Width
'
' Open Preview window in picturebox

[Code]....

As you can see, I have 2 sources. Would it be possible to not show the preview window, but instead loop through all the sources?

That would be in a timer, so like each 10 seconds a pictures is made from each source.

View 1 Replies

VS 2008 Looping Through Controls On Win Form?

Feb 11, 2012

i have a winform and i have about 30 labels and 30 picture boxes on it. What i would like to do is fill each label and picturebox with a value and image from a backend database. I could have easily done this in vb6 using control struture , for eg.

for x = 1 to 30
picturebox(x).image = value from database
label(x).caption = value from database

[code]....

View 3 Replies

Create A List Of Structures Within A List Of Structures?

Jul 20, 2009

I'm attempting to create a list of structures that contains a list of structures. I can't seem to figure out how to properly allocate the object for the inner list of structures. I expect the outer list of structures to have a couple thousand entries and the inner list of structures to be fairly small at 2 to 10. Both lists will grow over time but the number of elements within the inner list will be constant for an instance of the outer list. Meaning, if an instance of the outer list has 2000 entries each of those will have the same number of elements on the inner list, say 4 entries.

Here is a simplified code fragment. This fragment makes no attempt to create the instance of the inner list "StructBlist" since I can't figure out where to put it. Tried "New List(Of StructB)" in the declaration as well as "Alist(0).StructBlist = New List(Of StructB)" but neither works.

Public Class Form1
Structure StructA
Dim FieldA1 As Integer

[Code]....

View 5 Replies

VS 2008 / Looping Through Textboxes, Outputting To String ?

Feb 21, 2010

I have a number of textboxes in my program, and a few other controls with text in them.I want to loop through a select number of textboxes (1-10 in this case, for testing), and output their combined data into a string.Here is what I created, with the help of someone on this forum earlier.[code].....

View 4 Replies

VS 2008 : Looping Regex Match Collection?

Jan 3, 2010

I have my regex setup, which works prefectly:

vb.net
Dim testStr As String = "<option value=""18621335"">graham23s</option>"
Dim rx As New Regex("<option value=""(d+)"">(.+?)</option>")

[code]....

When i put it into my own application i have done:

vb.net
Dim stringSource As New Regex("<optionvalue=""(d+)"">(.+?)</option>", RegexOptions.IgnoreCase Or RegexOptions.Singleline)
Dim stringMatches As MatchCollection = stringSource.Matches(stringCle

[code]....

what i am having trouble with is getting the values while in the foreach loop.

View 3 Replies

VS 2008 : Looping Through All Directory's On The Hard Drive?

Oct 6, 2010

i have this piece of

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim strFileSize As String = ""
Dim di As New IO.DirectoryInfo("C:")

[code]....

and it works just fine. However, saying that, i need to find a way to loop through ALL the directory's on the "c" drive and not just the main folder.

View 5 Replies

VS 2008 Looping Through The Contents Of A ListView Control

Jul 3, 2011

I'd like to go through all the items of a ListView control in order to ... well execute some code. I suppose I have to use the "For i=1 to ..." statement , but I am not familiar at all with this control. As I said , I'd like to check all of the items (the elements in the first column) and for each of them that has "Yes" on the third column , I would like to run the rest of the code .

View 9 Replies

VS 2008 See If Checkboc Is Checked When Looping Through Controls?

Jul 29, 2010

I am looping through all controls on my form and for all checkboxes, I want to see if they are checked. I cannot get the Checked property when doing this. Am I doing something wrong?

[code]...

View 2 Replies

VS 2008 Set Looping And Progress Bars And Hotkeys?

Sep 12, 2009

Ive been trying to work with looping code and get messeges like this.

[Code]...

But that is not important this moment... How would I set a code too use the progress bar? So As it loops at a certain rate {Lets say 1000 (1 sec)} It would show the progress. Currently using it to 1 - 50. (Note: The rate is not important as I know how to set that) EDITEDITEDIT: Thanks for the info so far, But regarding my other thread about hotkeys that I marked "Resolved"

[Code]...

View 5 Replies

What Is The Most Efficient Method For Looping Through A SortedList In VB 2008

Oct 29, 2009

The code below shows me (I think) that the "for each" loop is about 10% faster than the "i to n" loop, but the "for each" loop creates 567k in new memory? Is this right? Which way is generally most efficient with regards to speed and memory usage? If you want to run this code in VB just add a button and 2 labels to a form.

[Code]...

View 1 Replies

VS 2008 Looping Through Combo Box TEXT - Regardless Of Datasource Impossible?

Jul 26, 2009

I was wondering how i can loop through a combo boxes items display item field - and return the value for each - i want this to be generic regardless of the combo boxes data source - or if the combo box has been populated with a string list / class etc

View 3 Replies

VS 2008 Looping Through Txt File To Grab Case Numbers?

Feb 18, 2011

I have code to automize the creation of medical record charts in a data tree structure. I need to loop through a basic .txt to get relevant current case numbers and automate their chart creation structure. hat's wrong here... Msgbox(s) is returning my file name - not the first line in the file.

HTML
Dim myRootpath As String = "\backupcenterPDF_Archives$MedRecords"
Dim myTemplatePath As String = "\rbase$EMRTemplates"

[code].....

View 5 Replies

VS 2008 Adding Class Object To List Or Array In A Different Class

Jun 21, 2010

I am trying to create an list or an array of a class.Here is my "Ingredient" class that I am trying to create a list of:[code]In my "recipe" class, I am want to create a list (or array) and I am drawing a big blank on how to do it. Can anyone point me in the right direction?

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved