VS 2008 Record A Path Of A Sequence In A VB Recursive Function?

May 10, 2010

I am working on networks. My work involves finding out what nodes connected to a specific node (Source node). I have developed a code which does this using a recursive function. The only problem that I have I need to record the path. For example shown in the picture below, my program give me the following results:

1 Node 3 is conncted to 1 via 1
2 Node 5 is conncted to 1 via 3
3 Node 4 is conncted to 1 via 1

[code].....

View 2 Replies


ADVERTISEMENT

Record A Path Of Sequence In Program Recursive Function?

May 9, 2010

I am working on networks. My work involves finding out what nodes connected to a specific node (Source node). I have developed a code which does this using a recursive function. The only problem that I have I need to record the path. For example shown in the picture below, my program give me the following results[code]...

View 1 Replies

How To Exit Recursive Function And Record Required Data To List

Jun 18, 2010

I want to exit a recursive function once the a number is repeated in a list. i.e. In the following code I have 'AST' as a list. How can I stop adding data to the list once the first number repeated?

The result in the below code is:
1 2
4 5 1 2
4 5
1 2 4
5 1
2 4 5
1 2
4 5 1
1 3
3 5 6
3 3
1 3 3
5 6
3 3 1
3 3
5 6 1
5 6
1 5 6
1
What I want for AST to be: 1 2 4 5 1, because 1 is repeated.

Just Add to your form a richtextbox and a button.
Public
Class Form1
Dim TheConnectionsValue(6, 6)
As Integer
Dim NumberOfNodes
]Code] .....

View 4 Replies

Recursive Function Vs Factorial Function

Nov 20, 2009

Can someone explain to me what the difference is between a recursive function and a factorial function. I know that a factorial function returns the product of all the numbers from 1 to itself. But how does that differ from what a recursive function does

View 2 Replies

.net - Recursive Function Not Returning?

Nov 28, 2011

I am hopeing someone can help me here with a recursive function I have that is not returning either true or false as I would have espected it to. The function loops through a Active Directory group for its members and then calls itself if it encounters any groups within the membership in order to gets its members as well. I am trying to return either true or false based on if any errors were encountered but not haveing any luck at all. It appears to just hang and never return back to the primary calling sub that starts the recursive function. Below is my code I am using:

[Code]...

View 1 Replies

Designing A Recursive Function?

Jan 17, 2011

I have the following data in this a table

ID ParentID Active Node
1 0 1 <RCExtRequest>?</RCExtRequest>

[Code]....

If changing the table layout would make this any easier then I could so that.

View 2 Replies

How To Run Recursive Function In Different Thread

Feb 11, 2011

i have these 2 functions that search for any .jpg files starting from a given path the algorithm works, it's just that it freezes up the gui at times this is why i wish to know how to implement it through a new thread or a backgroundworker maybe.[code]

View 2 Replies

Recursive Function Works On X86 But Not X64?

Mar 12, 2011

I'm making a program that can mark my shooting cards and i have created it and it works nicely But i want to get as much speed out of it as possible so I switched my target CPU to X64 and sure enough my recursive function threw a Stack overflow exception telling me i need to make sure i don't have Infinity recursions. Strangely when I set It back to X86 the same recursive function works...

vb.net
Dim bullethole As New List(Of Point)
Function GetBulletHole(ByVal point As Point) As Point()

[Code]....

View 12 Replies

Use A Recursive Function On An Array?

Nov 21, 2009

Is it possible to use a recursive function on an array

If I have an array like this[code]...

I want to use a recursive function to make in out like this[code]...

View 4 Replies

Access Variable Outside Of Recursive Function?

Dec 8, 2009

I have a recursive function in this function i am adding some value to path variable here i want to acess this value outside of function for this what changes i will do in this function.

Private Sub GeValuePath(ByVal ParentID As Integer)
Try
dim path as string =""

[Code]......

View 1 Replies

Recursive Function Is Not Working Properly?

Feb 11, 2010

have an xml file like this.

<?xml version ="1.0" encoding ="utf-8"?>
<menu>
<menuNode title="Register" value="true">

[Code]....

View 2 Replies

Recursive Function Using 3 Variables With 3 Different Values

Feb 14, 2011

I have 3 variables. Lets call it "a", "b" and "c". These 3 variables can "independently" have 3 different values. Lets say: "1", "6" and "10". when you think of them as combination; there are (3^3) 27 combinations. I am told that it can be done through the recursive functions. However i am not a good developer to handle with that. Would u please help me?

- 3 variables and 3 different values are simplified. In fact; the numbers of variables and different values can vary.

- i know only the language, visual basic in .net; please don't answer in other coding languages.

additional note: i am going to put the these combinations in the string format into a collection.. for example "1;1;1", "1;6;1", "1;6;10".. and so on..

View 7 Replies

Recursive Function With Dynamic Treenode

Aug 16, 2011

I have a recursive function wich objective is scan an structure and represent that structure with treenodes. Inside my function depends the structure I'll have to create another treenode inside my treenode or just create a node. My problem is that I don't know how to remember my treenode position when I have to call my function again.

If strTop.TextString.ToUpper = "DMN" Then
gcTreeno.Nodes.Add("Node")
Else
Dim perf As New TreeNode
gcTreeno.Nodes.Add(perf)
End If

if i would like to write next time a node into perf, how i could do it?

View 1 Replies

Using A Recursive Function To Remove A Character?

Nov 21, 2009

How can I use a recursive function to remove a character from a string thats stored in a array.

Like so

MMMMM
MMMM
MMM
MM
M

I need to remove a letter from the string each time it loops through the string until there is only 1 letter left in the string.

View 7 Replies

Improving Recursive Active Directory Function?

Mar 2, 2012

I'm hoping to improve the performance of the below as well as return the GUID of each user.

I've converted and modified the code found here for searching through groups recursively to get all the members and their details and adding them to a class collection. However I also need to capture the user's managers details so I'm calling the AD twice for each user. This doesn't seem efficient as many of the users will have the same manager. It would seem logical to get the distinct manager details from the collection class and call only these, then replace them wherever they occur in the collection.

I'd also like to be able to get the user's GUID, I've tried accessing it directly as a property of the collection, but it doesn't return anything.

I'm using vs2005 and .Net 2.0

Public Class ADCLass
''' <summary>
''' Calls recursive function to return users in group

[Code]....

View 1 Replies

Recursive Function Won't Exit Code Inside?

Apr 6, 2009

this its a function i made to make sure all the fields on a form are filled before to save to database but once it finds a object it should exit. but it just doesnt... i tried also with exit for and exit sub also tried puting the exit for just after the msgbox shows up but it wont exit, this its the last thing i did using a flag but it doesnt exit either.

[Code]...

View 10 Replies

Rewrite This Recursive Function To Remove The Recursion?

Dec 29, 2009

I got that little function(I changed the name of variables)

Private Function everythingLinked(ByRef myClass As cls, ByVal found As Boolean) As Boolean
If Not found AndAlso myClass.checked = False Then
myClass.checked = True

[code]....

I want to rewrite it so it would only be loop and no recursion and I'm currently lost?I'm passing a class to this function(with a starting value for found as false) to know if it is linked to the middle of the tree. The class got an array with a maximum of 4 link to other class and it can be circular(this is why I have a checked_link boolean).It does the recursion until there is no more link(return false) to check or until it find the middle link(return true).

edit?for an example, this

in pos 0 got link with 1
in pos 0 got link with 6
in pos 1 got link with 0

[code]....

middlepoint would be pos 15 the code above can prove that every position can be linked with the middlepoint so initial arg would be

everythingLinked(random pos, false)

and in this case it would be always true

View 5 Replies

Turn A Recursive Function Into A Stack Base?

Mar 23, 2011

i have been asked to turn a recursive function into a stack base but i am not sure what that's mean but i choose the fibonacci recursive function and i turned it into the stack base ?Public Function fib(ByVal value As Integer) As Integer

Dim x As Stack
x = New Stack(30)
Dim temp As Integer = 1
Dim result As Integer = 0

[code]....

View 3 Replies

VS 2005 Nested Loop Vs Recursive Function?

Aug 18, 2010

I'm trying to make a simple game tree.Previously I used nested loops:

[Code]...

View 10 Replies

Working Function Adding Recursive Breaks It?

Oct 21, 2010

I am looping through all folders on the computer in a background worker. Starting with just the C: drive, the function works perfectly I've been tasked with adding recursiveness to this function to loop through all subfolders within each and every folder.

This is the working code without recursive. Startpath is set = "c:".

Private Sub BackgroundWorker1_DoWork(ByVal sender As Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
Dim fs As New FileSystemObject
Dim fsfolder As Folder
Dim subfolder As Folder

[Code]...

EDIT: I was doing some testing and threw in an if check to skip the C:$ folders. Working ok so far and noticed something really strange. It doesn't loop through all the folders in the C: drive. I think it will loop through only the first 2 folders. One is C:Boot so I skip that and the other is C:Dev-cpp. It won't loop through the Program Files, Program Files (x86), or Users.

View 4 Replies

An Infinite Loop In A Recursive DirInfo.GeDirectories Function?

Oct 25, 2010

I am descending all the directories of my C drive to get a complete list of all extensions.When I get to: C:Windows.oldDocuments and SettingsAll UsersApplication Data

the program goes into a loop: C:Windows.oldDocuments and SettingsAll UsersApplication Data Application Data Application Data until the path exceeds maximum length (248 characters for the directory).

[Code]...

View 3 Replies

File I/O And Registry :: Using Recursive Function For Directory Tree?

Dec 2, 2008

I am trying to write code to save (in a text file) a list of folders/files that are contained in a specified folder. I want the list to be formatted to illustrate the folder tree structure by indenting sub-folders and there related files according to their relationship to the base folder.

I found and incorporated a recursive function for listing file & folders. This works fine for generating the list, but I am having difficulty with code to determine the sub-directory level relative to the base folder. the code that I have included below sort of works.......The problem seeme to be when going from a folder that is multiple levels up? from the base to one that is only one level from the base. Refer to my sample output. This should not be as difficult as I seemed to have made it, but recursion kinda blows my mind.

Code:
' The following function call is in a button handler
GetFilesFolders(txtBaseFolder.Text)
Public Sub GetFilesFolders(ByVal path As String)

[code]....

View 2 Replies

Using A Recursive Function To Retrieve All The Files/folders Within A Directory?

Feb 11, 2012

I am currently using a recursive function to retrieve all the files/folders within a directory.Sometimes this takes a while. I am wondering if I am able to calculate the total number of files/folders within a directory before retrieving the filenames so that I can implement a progress bar?

View 1 Replies

.net - Function That Always Returns The Next Integer In A Sequence

Feb 10, 2012

I need top create a function that gets the next integer in the sequence of 1 to 60. Each time the function is called, I need it to increment from what the last value was and return the next number as the result. It also cannot return the same integer in 2 consecutive calls. When the count gets to 60, the sequence needs to reset back to 1. I would like to function to have no parameters.

I have created a function that does this using the cache to store the last value that was returned, but I am worried that with concurrent calls to the function that it might not work as I expect and 2 calls could get the same integer.

Is cache blocking the correct method to use in this instance or is there something other method I am not thinking about?

Also, stuck using .Net 3.5 and this is a web application.

I just wrote this function based on using SyncLock. Any obvious problems with it that I don't see? I am using the Cache to save the last value that was returned.

Private Shared Function GetNextNumber() As Integer
Dim o As Integer
Dim r As Integer

[Code].....

View 4 Replies

Multiplying Odd Numbers In Sequence Using MOD Function?

Jul 2, 2010

Then you have to take that same range and find the product of all odd numbers between said sequence. I figured out how to find the product but only if the lowest number is also an odd number. For example, if I put in the values 1 and 7 the product is 105 which is correct. But if I put in 2 and 5 the product somehow becomes 10, when it should be 15.I have to use the MOD function to distinguish between even and odd numbers, which I know how to do however it's still not working out correctly for some reason and I'm completely stuck. This is the part I'm having trouble with. Go down for full source)

For counter = intX To intB
intX = intProduct
If intY Mod 2 = 0 Then

[code].....

View 6 Replies

Website Crawler Creating Recursive Function To Get All The Site Link

Aug 26, 2009

i'm trying to build websites crawler and i having a bit of problem creating recursive function to get all the site link, provide a link to an example ?

View 2 Replies

Create A Function To Convert A Mapped Drive Path To A UNC Path?

Apr 7, 2009

I am trying to create a function to convert a mapped drive path to a UNC path. I did some googling and found several different pages on the matter. I am most interested in the first one, but I cannot seem to get the code to cooperate. Since the original post was in C#, here is my VB.NET conversion:

[Code]...

View 1 Replies

Recursive Function With "governer" Still Crashing My Server ?

Feb 12, 2009

I've been running this recursive function below and it keeps crashing my server. If I change the recursive part "checkparent = checkparent(xmlsrc, cnt2)" to "checkparent = "none"" it doesn't crash. I through in the cnt2 integer so that if it got further than 10 levels deep it'd stop, that way it shouldn't get into an endless loop.

CODE:

View 5 Replies

VB 2008 Express: Recursive Use Of New Point (?)?

Jan 22, 2010

I have a VB 2008 Express program that uses a sequence of functions to move a set of image controls randomily until they meet some criteria as returned by a function, named here Passed().The random placements can result in an unsolvable solution, i.e. an infinite loop; So I've implemented a timer check that triggers just longer then the typical solution time (~2 seconds). Assumption being that any attempt longer then typical is likely headed to oblivion.

Upon timer trigger I attempt to reset all the images to a known location and simply recall the preceeding functions to again try placing them until they meet my desired outcome.I believe I am encountering an out of memory type error, due to an apparent corruption of the display (great big white area appears for no apparent reason and program never returns without manual halt). Program does appear to restart properly a couple of times before this 'lock-up' occurs.

Example of my code,

Public CnameA, CnameB as String
Public Cmax as Integer = 10
Private Sub Form1_Load(...)

[code]...

Is it possible that the calling of New each time might be filling up the available heap / memory (there are a lot more images then the 5 demonstrated here. I am unsure how to clear it and even if I did would clearing the memory associated with New Point () cause my images to not be displayed?

View 5 Replies

VS 2008 : Optimize Recursive Treeview With AddRange?

Jun 23, 2009

I have this seperate class to fill a treeview from my database.There are over 33000 records and when this class runs, it takes almost 1 minute to finish.When i run this query from the server it takes for 5 seconds to retrieve all items.Is there a way to optimize this class?

Option Explicit On
Option Strict On
Imports System.Windows.Forms

[code]....

View 19 Replies







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