Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Making Changes To Linked List


Ok i'm reading in a record with codes (TC) that tell me what to do, I'm having problems w/ the changings (C) right now. I'm not doing something right. When i read it in i need to see if the transrecord is missing data, if its missing both the CarName and QOH then i don't want to use it because then their are no changes to make but if its missing one or the other thats fine and if it has both of the data thats fine too. I don't know what to do differently.


VB Code:
Private Sub LoadSearchSinLinkList()ReDim Preserve myarray(120) As StringHead6Do Until EOF(8) = True    Input #8, TransRecord    Key = Left(TransRecord, 4)    CarName8 = Mid(TransRecord, 5, 20)    QOH8 = Mid(TransRecord, 25, 3)    TC = Mid(TransRecord, 28, 1)    If TC = "D" Then            DeleteSinLinkList        ElseIf TC = "C" Then            ChangeSinLinkList        ElseIf TC = "A" Then            AddSinLinkList        Else            Print #6, Key & vbTab & CarName8 & vbTab & TC & vbTab & "Code Unknown"        End IfLoopEnd Sub Private Sub ChangeSinLinkList()SearchSinLinkListIf CarName8 And QOH8 = " " Then    Print #6, Key & vbTab & CarName8 & vbTab & TC & vbTab & "Missing Data"ElseIf Flag = True Then    If CarName8 And QOH8 <> "" Then        CarName = CarName8        QOH = QOH8    ElseIf CarName8 = "" Then        QOH = QOH8    Else        CarName = CarName8    End IfElse    Print #6, Key & vbTab & CarName8 & vbTab & TC & vbTab & "Invalid Key"End IfEnd Sub Private Sub SearchSinLinkList()ReDim Preserve myarray(120) As StringStartLoc = ListPointerPrevLoc = 0Flag = FalseIf Left(myarray(StartLoc), 4) = Key Then    Flag = True    StartLoc = StartLoc + 1Else    If Left(myarray(StartLoc), 4) < Key Then        PrevLoc = StartLoc        If LLPointer(StartLoc) <> "999" Then            StartLoc = LLPointer(StartLoc)        Else            Flag = False            StartLoc = StartLoc + 1        End If    Else        Flag = False        StartLoc = StartLoc + 1    End IfEnd IfEnd Sub




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
A List Of Linked Items (linked List)
I want to be able to create a list of linked items, i.e. a linked list. I know how to do this in C but I am not clear about setting this up in VB. In C it involved "pointers" set to point at various elements of data and generally the pointers used were element of
"structures" (the vb equiv would be "type" ).

The list needs to be elements, whether "types" or not, linked by some method . such that one can nav through memory from one element to another , and back again.

Someone already has briefly mentioned the possibility of using collections ?....(I do not know how to implement them in code!)

Can anyone please help me ?

Linked List
Yet another VB Linked List example.

This one uses GetMem4 and PutMem4 for efficient (not as efficient as pointers of course) memory manipulation.

Enjoy!

Linked List
Hi

I need to know how to create a linked list of objects items.

In VB of course

thanks

Linked List In VB?
I have a text file with records stored in it. I am not using VB datbase
capabilities, since it consumes more resources.
I want to load the entire records in a Linked list and the user can
work on it. When he clicks save, the entire file will be overwritten.

How to create a linked list in VB?

Is my approach towards file handling correct? If not, suggest.

Linked List Help!
I'm trying to created a linked list in VB (no i can't do it in C, i have to do it with an array and i can't use cases or anything like that i have to follow this general format) So what i'm trying to do is clear the sortarray w/ asterics then put in the myarray. Because there are only 100 records in the first array after the 100 records there should be 20 lines of asterics printing but there is not. Also my pointer fields are not right. Help!!!!


Code:
Private Sub ClearSinLinkList()
ReDim sortarray(120) As String
For Counter = 1 To 100
IdNum = "****"
CarName = "********************"
QOH = "***"
Price = "*********"
QOO = "***"
Supplier = "*****"
myarray(Counter) = IdNum & CarName & QOH & Price & QOO & Supplier
Next
End Sub

Private Sub SinLinkList()
ReDim Preserve myarray(101) As String
ReDim sortarray(120) As String
PageCount5 = 1
Head5
NumEntries = Counter
StartLoc = 1
ListPointer = 1
NextLoc = 2
Do While StartLoc < NumEntries
sortarray(StartLoc) = myarray(StartLoc)
StartLoc = NextLoc 'according to the teacher it looks like the StartLoc needs to be Pointer(StartLoc) but that won't work
StartLoc = StartLoc + 1
NextLoc = NextLoc + 1
Loop
sortarray(StartLoc) = myarray(StartLoc)
'StartLoc = 999 if i do this it won't go into the do while but this needs to also be done according to the teacher to the last record
'Print Singly linked list
StartLoc = 1
mainoutct5 = 1
Do While StartLoc < 120
IdNum1 = Left(sortarray(StartLoc), 4)
CarName = Mid(sortarray(StartLoc), 5, 20)
QOH = Mid(sortarray(StartLoc), 25, 3)
Price = Mid(sortarray(StartLoc), 28, 9)
QOO = Mid(sortarray(StartLoc), 37, 3)
Supplier = Mid(sortarray(StartLoc), 40, 4)
Print #5, IdNum1 & vbTab & CarName & vbTab & QOH & vbTab & Format(Price, "Currency") & vbTab & QOO & vbTab & Supplier & vbTab & vbTab & StartLoc
StartLoc = StartLoc + 1
mainoutct5 = mainoutct5 + 1
If mainoutct5 > 50 Then
PageCount5 = PageCount5 + 1
Head5
mainoutct5 = 1
End If
Loop
Print #5,
Print #5, "The List Pointer Is" & " " & ListPointer
End Sub

Linked List?
I'm never worked with linked list before and i did a search for it online and everything for linked lists was in C but i have to do it in VB. A little help and explainations along the way would be nice.

Ok First the records get sorted then the linked list needs to get cleared w/ asterisks then loaded. As of right now its not loading when i debug it it looks like its at the last record which is why its not going in because it's already at the EOF (and if the records were already loaded in an array and was sorted it would make sense to be at the last record) but how do i fix that.


Code:
Private Sub ClearSinLinkList()
ReDim Preserve myarray(120) As String
For Counter = 1 To 100
IdNum = "****"
CarName = "********************"
QOH = "***"
Price = "*********"
QOO = "***"
Supplier = "*****"
myarray(Counter) = IdNum & CarName & QOH & Price & QOO & Supplier
Next
End Sub

Private Sub SinLinkList()
ReDim Preserve myarray(120) As String
Do Until EOF(1) = True
Input #3, record
SingRecord = record
NumEntries = Counter
StartLoc = 1
ListPointer = 1
NextLoc = 2
Key = 1
Do While StartLoc < NumEntries
myarray(StartLoc) = SingRecord + Key
StartLoc = NextLoc
StartLoc = StartLoc + 1
NextLoc = NextLoc + 1
Key = Key + 1
Loop
Loop
myarray(StartLoc) = SingRecord + Key
StartLoc = "999"
'Print Singly linked list
mainoutct5 = 1
Do While StartLoc < 120
IdNum1 = Left(myarray(StartLoc), 4)
CarName = Mid(myarray(StartLoc), 5, 20)
QOH = Mid(myarray(StartLoc), 25, 3)
Price = Mid(myarray(StartLoc), 28, 9)
QOO = Mid(myarray(StartLoc), 37, 3)
Supplier = Mid(myarray(StartLoc), 40, 4)
Print #5, IdNum1 & vbTab & CarName & vbTab & QOH & Format(Price, "Currency") & QOO & Supplier
StartLoc = StartLoc + 1
mainoutct5 = mainoutct5 + 1
If mainoutct5 > 50 Then
PageCount5 = PageCount5 + 1
Head5
mainoutct5 = 1
End If
Loop
Print #5,
Print #5, "The List Pointer Is" & "" & ListPointer
End Sub

Linked List In VB
Can we make one or something like linked list in VB?
Thanks.

Linked List In VB?
I have a text file with records stored in it. I am not using VB datbase
capabilities, since it consumes more resources.
I want to load the entire records in a Linked list and the user can
work on it. When he clicks save, the entire file will be overwritten.

How to create a linked list in VB?

Is my approach towards file handling correct? If not, suggest.

Linked List
is there a way to do linked list in VB?? i need to have an array of 500x500x3 but this is much too big for a regular array. What i need is a way to do linked list (C++) in VB so i can store this data in memory

this is an array of ints

Linked List
I have a class which I want to create a linked list of, so I can easily remove and add objects of that class, how do I do it in VB?

Linked List In VB??
Can you,make a link list in vb i hope so if there is a solulation then please help me out !.!.!

Linked List
Does anyone know where I can find a good linked list module ?

would like to have a module that adds, deletes and refreshes the list from base pointer.

Im running xp pro



Edited by - Malan on 4/26/2004 8:57:59 AM

OOP Linked List..NEED HELP
I create a linked list class successfully - called as LinkedList.h, LinkedList.cpp
Then I go to create another class called class A. I added all the values here and success in inserting and retrieving all data.
Then I create another class called class B. But i failed to get the count of the list and retrieve data.

I can't declare the LinkedList value to static. I don't know how to keep the record in memory so that other class who needs the value can use it as well.

Can somebody in this group help me? I stuck at the place for two days already. Thanks.

Linked List In VB 6.0
Hello! I couldn't find anything in the FAQ about how to implement a linked list in VB, and all the internet tutorials I've found are unnecessarily complicated in my opinion. So I wanted to make a small and simple guide just to cover the basics. I hope some people will find this useful and easy to understand.

First some background that you can skip if you already know what a linked list is. A linked list is a series of identical objects that are "linked" together, meaning that one of the member variables of each object will refer to another object of the same type. Each object (link) has a "next object" that he points to, and that object has its own "next object", and so on. Those pointers keep the list's integrity intact. If one link doesn't point to the next link that it's supposed to, the list is "broken". Since the last link in the list doesn't have a "next" to point to, it always points to NULL (Is Nothing). We use that to tell whether or not we're at the end of the list. Linked lists have some advantages over arrays: their size is not hard-coded at design time, they can easily expand and contract in size, and it's easy to insert a new link anywhere in the list. But accessing a specific link somewhere in the list takes longer than accessing an arbitrary array element, because you (usually) need to scan the list from the start each time you access any link.

So on to the good stuff. We need a class to represent a single link, and then we need a class to represent a list of links. Add a Class Module to the project and name it CLink. This will represent each link in the list. Put this code in the class:


Code:
Option Explicit

Public Data As String
Public MyNext As CLink

Data will hold the actual value for this link, like a single array element value. It can be any data type, and of course there can be more if you need. MyNext will point to the next link in the list. Its data type must be an object of the same type (in this case CLink).

Now that we have a link, we need a list of them. It's best to make another class to maintain the list, so add another Class Module and name it CList, and put this code in it:


Code:
Option Explicit

'This always points to the first link in the list.
Public Start As CLink

Public Sub AddToFront(strData As String)
'Adds a new link to the beginning of the list. If the list is empty, it creates the
'Start link, otherwise it creates a new link and makes it the new start of the list.
Dim Lnk As CLink

If Start Is Nothing Then
'First link is being added, just create the Start link.
Set Start = New CLink
Start.Data = strData
Else
'Create a new link and "wire" it to point to the old Start.
Set Lnk = New CLink
Lnk.Data = strData
Set Lnk.MyNext = Start
Set Start = Lnk
End If

End Sub

Private Sub Class_Terminate()
'Deletes all links that may have been created.
Dim Lnk As CLink
Do While Not Start Is Nothing
Set Lnk = Start 'Remember who Start.MyNext is before we delete it
Set Start = Nothing 'Delete the link here
Set Start = Lnk.MyNext 'Loop to the next link
Loop
End Sub


The public member "Start" is the main way to traverse and use the list from outside the class. It should always point to the first link in the list. The AddToFront function does just what it says - it adds a link to the front of the list. The details are commented, but basically if the Start link (or node) hasn't been created yet, then it assumes the list is empty and creates the Start link. Otherwise it creates a new CLink object and sets it to become the new Start. The Class_Terminate function is just cleanup stuff, so the list is responsible for deleting any links that were created when the list goes away.

That's pretty much it. Now that we have a list, the only thing left is to actually use the thing. Remember that you always use the list by navigating from its Start. That means we need to declare a CLink variable (maybe called Lnk) and set it to the list's Start. Then we can traverse the list with a series of Lnk.MyNext calls. When Lnk.MyNext Is Nothing, we know we're at the end of the list. Here's the code I used to test this:


Code:
Private Sub Command1_Click()
Dim i As Integer 'A counter
Dim Lst As CList 'The actual list
Dim Lnk As CLink 'A temporary CLink variable

'Create the new linked list.
Set Lst = New CList

'Add some stuff to the list for testing.
For i = 0 To 7
Lst.AddToFront CStr(i)
Next i

'Start at the front of the list.
Set Lnk = Lst.Start

'Loop as long as Lnk points to a valid CLink object in the list.
Do While Not Lnk Is Nothing
List1.AddItem Lnk.Data 'Here's the link's data being used
Set Lnk = Lnk.MyNext 'On to the next link in the list, might be Nothing
Loop

Set Lst = Nothing
End Sub


After running this code, List1 will look like this:

7
6
5
4
3
2
1
0

The numbers are listed backwards because each successive number was added to the front of the list, and we traversed the list from Start to end. So that's exactly what we should have expected. For practice, to fix this you could include an AddToEnd function to the CList class (or even AddToMiddle). Other useful functions are RemoveFromFront, RemoveFromMiddle, etc. Just declare a Lst variable inside the function, set it to Start, and traverse the list in the same way as populating the listbox, until you find the link you're looking for. When adding or removing links, make sure to correctly "rewire" the MyNext values
so they point to the right thing afterward, otherwise the list gets "broken" and your data will be floating around doing nothing.

This is just a singly-linked list, meaning you can only traverse the list in one direction (from Start to whatever). If you want to go backwards, make a doubly-linked list by adding a Tail link as another public member of CList, and add MyPrev to the CLink class. And of course keep them set correctly whenever a new link is added or removed. There are also circularly-linked lists, where Tail.MyNext points to Start.

Hopefully after this you can implement one of these other lists without much trouble. The concepts are pretty much the same, just keep each link pointing to the proper next and the list should handle itsself. Happy coding!

Linked List
Can someone please help on how you would create a linked list in VB?
Thanks!

LINKED LIST
HOW TO DYNAMICALLY CREATE A LINKED LIST USING 2 text FILES AND GENERATE A MIXED FILE OUT OF THESE 2 FILES?
For eg., I have one.txt and two.txt each file having just 1 word per line. how do I link these 2 files dynamically and create a third file that has the contents of both one.txt and two.txt randomly. I want to mix these 2 .txt files randomly and generate a third file.

banusvasan

Linked List From VC++ DLL To VB
Hi!
I just joined everyone here after reviewing ALL the DLL postings in hope of finding a solution to my problem to no avail. I'm basically a C++ programmer (limited VB knowledge) with the following problem at hand:

I have written a C++ DLL that creates a C++ object which in turn generates a dynamic linked list of structs. Each list element (C++ struct) also has 2 linked lists of structs within it. In short, my structs contain ordinal values (strings, ints, longs, etc.), pointers, as well as pointers to other structs.
I then created matching VB class modules that correspond to all my C++ structs. The VB application succesfully calls the DLL which in turn successfully generates the linked list, but how do I access that data from VB? The problem I'm faced with now is: How can the VB application retrieve the linked list from the DLL? How do I fill the VB class modules with the data generated by the DLL?

Thanx all!


"For every complex problem, there is a solution that is simple, neat, and wrong." - H.L. Mencken

Linked List
Hi,
Since i cant find any way to use pointers in VB i wonder how can i create one in class module or how can i build linked list without pointers...

TIA

Simple Linked List
Hi, I need to know the algorithm for a linked list for my college computing course, so I thought I'd have a go at programming one to help me understand it.

I have attached the begginings of my code. From what I can see (I've gone through what should happen on paper), it should work so long as the value you put in is not either a value that would be last or first on the list alphabetically.

I have been using 'Elephant'.

However, the text box displaying the link number does not display anything when I try and add an item.

The code is very short, so can someone have a look through please and see where I have gone wring?

There are loads of unused variables delcaired (lots that I thought I might need and then never did).

thanks a lot,

Robin

Linked List Sorting
I want to sort an array of linked lists, but the catch is that only the first nodes of every linked list in the array are sorted against each other. For example:

Linked List 1: 7-->3-->5
Linked List 2: 3-->2-->4
Linked List 3: 5-->1-->9

becomes
3-->2-->4
5-->1-->9
7-->3-->5

The Old Linked List Chestnut
So, I'm naively trying to implement something that's basically a linked list in VB, using Objects to dynamically create nodes.

I want to write a recursive append function in Node.cls

Here's the pseudo-code for Node :

public data as MyData
public nextNode as Node

sub append(aData as MyData)

if nextNode = null then

set nextNode = new Node
nextNode.data = aData

else

nextNode.append(data)

end if


The problem is, that I can't seem to work out how to write the "nextNode = null" test. Both isNull(nextNode) and isEmpty(nextNode) seem to fail, even when nextNode hasn't been set to anything.

This must be possible, so what's the right solution?

cheers

phil jones

Deleted From A Linked List
i have a singly linked list and i'm trying to delete a record, my problem comes when the record is read in to delete a record that doesn't exist. What can i do to check for a file that doesn't exist?



VB Code:
Private Sub SearchSinLinkList()ReDim Preserve myarray(120) As StringHead6StartLoc = ListPointerPrevLoc = 0Do Until EOF(8) = True    Input #8, TransRecord    Key = Left(TransRecord, 4)    CarName8 = Mid(TransRecord, 5, 20)    QOH8 = Mid(TransRecord, 25, 3)    TC = Mid(TransRecord, 28, 1)Flag = FalseDo While Flag = False    If Val(Left$(myarray(StartLoc), 4)) = Key Then        Flag = True        StartLoc = StartLoc + 1   ElseIf Val(Left$(myarray(StartLoc), 4)) < Key Then        PrevLoc = StartLoc        If LLPointer(StartLoc) <> "999" Then            StartLoc = LLPointer(StartLoc) 'it brings up an error here saying its at record 101 - there is only 100 records in the file at the time that record is to be deleted    Else        Flag = False        StartLoc = StartLoc + 1    End IfElse    Flag = False    StartLoc = StartLoc + 1End IfLoopLoopIf TC = "D" Then    DeleteSinLinkListElseIf TC = "C" Then    ChangeSinLinkListElseIf TC = "A" Then    AddSinLinkListElse    Print #6, Key & vbTab & CarName8 & vbTab & TC & vbTab & "Code Unknown"End IfEnd Sub  Private Sub DeleteSinLinkList()If PrevLoc = 0 Then    ListPointer = LLPointer(StartLoc)    Print #6, Key & vbTab & CarName8 & vbTab & TC & vbTab & "Invalid Key"Else    LLPointer(PrevLoc) = LLPointer(StartLoc)    Print #6, Key & vbTab & CarName8 & vbTab & TC & vbTab & "Deleted"    IdNum = "****"    CarName = "********************"    QOH = "***"    Price = "*********"    QOO = "***"    supplier = "*****"End IfEnd Sub

Linked List Problems
Here's were i'm at so far, I am getting a pointer printing out (because i do want it to print) but as you can see i need the last record to equal 999 and it does not as of right not, also LLPointer is Dimed as a String right now because the way it's set up i can't Dim it as an Integer it brings up errors and won't run. I tried putting the do while loop as a do until 999 but it tells me its over 120 and won't run after that. What am i doing wrong and what can i do to fix it.



VB Code:
Private Sub SinLinkList()ReDim Preserve myarray(120) As StringReDim LLPointer(120) As StringPageCount5 = 1Head5NumEntries = CounterListPointer = 1NextLoc = 2StartLoc = ListPointerDo While StartLoc < NumEntries    LLPointer(StartLoc) = myarray(StartLoc)    LLPointer(StartLoc) = NextLoc    StartLoc = StartLoc + 1    NextLoc = NextLoc + 1LoopLLPointer(StartLoc) = myarray(StartLoc)'StartLoc = 999'Print Singly linked listStartLoc = ListPointermainoutct5 = 1Do While StartLoc <> 120    IdNum1 = Left(myarray(StartLoc), 4)    CarName = Mid(myarray(StartLoc), 5, 20)    QOH = Mid(myarray(StartLoc), 25, 3)    Price = Mid(myarray(StartLoc), 28, 9)    QOO = Mid(myarray(StartLoc), 37, 3)    supplier = Mid(myarray(StartLoc), 40, 4)    Print #5, IdNum1 & vbTab & CarName & vbTab & QOH & vbTab & Format(Price, "Currency") & vbTab & QOO & vbTab & supplier & vbTab & vbTab & StartLoc    StartLoc = StartLoc + 1    mainoutct5 = mainoutct5 + 1    If mainoutct5 > 50 Then        PageCount5 = PageCount5 + 1        Head5        mainoutct5 = 1    End IfLoopPrint #5,Print #5, "The List Pointer Is" & " " & ListPointerEnd Sub

Need Lots Of Help On Linked List
Ok i have never tried to create a linked list before so i'm not exactly sure what i'm doing. I kind of understand the concept but thats it. I tried looking it up online but of course everything i find on it is in C, but i need it in VB. I'm also not quite sure what to declare the pointers as. A little help would be nice.


VB Code:
Private Sub SinLinkList()ReDim Preserve myarray(120) As StringNumEntries = CounterStartLoc = 1ListPointer = 1NextLoc = 2Do While StartLoc < NumEntries    myarray(StartLoc) = record + Key [b]i know the record and key go here but thats all i know [/b]    StartLoc = NextLoc    StartLoc = StartLoc + 1    NextLoc = NextLoc + 1Loopmyarray(StartLoc) = record + Key [b] same here [/b]StartLoc = "999"'Print Singly linked listmainoutct5 = 1Do While StartLoc < 120    IdNum1 = Left(myarray(StartLoc), 4)    CarName = Mid(myarray(StartLoc), 5, 20)    QOH = Mid(myarray(StartLoc), 25, 3)    Price = Mid(myarray(StartLoc), 28, 9)    QOO = Mid(myarray(StartLoc), 37, 3)    Supplier = Mid(myarray(StartLoc), 40, 4)    Print #5, IdNum1 & vbTab & CarName & vbTab & QOH & Format(Price, "Currency") & QOO & Supplier    StartLoc = StartLoc + 1    mainoutct5 = mainoutct5 + 1    If mainoutct5 > 50 Then        PageCount5 = PageCount5 + 1        Head5        mainoutct5 = 1    End IfLoopEnd Sub

Linked List Algorithm...
Warning : I am extremely new to this!

Linked List Algorithm

Ok so i am learning VB, starting out with some common algorithms such as Binary chop search, shell sort, etc etc

I am now trying to figure out how to implement a linked list, and need some help!

As an example *simple as possible* take a census record form with name, gender, region and income fields.

I have 3 index files: income.dat (U,M,L), gender.dat (M,F) and region.dat (E,S,N,W) - all pointers at 0.

The combined info will be stored in census.dat.

Does anybody know how to create this... I figure the process will be along the lines of:

- open index files (read into separate arrays, close files)
- open census returns file (calculate and display census return no)
- allow user to encode a return
- update index/record pointers
- clean form (display next census return number)

So?

Well... can anyone provide a simple algorithm logic code that would allow me to save this data to a file in linked list form. And after allow it to be searched for example males in the upper income bracket.

P.S. its late so hopefully the above makes some sense! sorry in advance if it doesnt

Help With Pointer & Linked List In VB
ITtoolbox Portal for Visual Basic - http://visualbasic.ittoolbox.com/

Can VB 5 or 6 do Pointers & Linked List? If so how? With "C" I
can


point to a memory location and get the data at that address. How
can


I get the address of a variable and then get the information at
that


address. Any information on Pointers and Linked List in VB would
be


helpful.



Thanks,
Al



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~

Database Linked List
Hello ppl,

i currently have a lil problem in solving the following: I have a database in MS access named MainDb which has a table called menu.. This menu table has 3 columns: Key, Name and ref.

Now the key is the unique key of a menu, the Name is the name of the menu and the ref indicates to which menu (parent) it is attached. ref NULL means that the menu is a parent

Therefore the follwing:

Key Name ref
1 File
2 Edit
3 New 1
4 Copy 2
5 Project 3 ----> Sub menu of sub menu 'New '
6 View 1

(this database may change at any time)

Now using this i must populate a tree view in VB.... This is where i need help... Must i use recursive funnction to go down the submenus (which i'm having problems) or is there a way of adding nodes to other nodes dynamically

Plz help me in finding a logic to do it or a sample code will be greatly appreciated

Thanks in advance
Bernard
So plz

Replicating A Linked List
Hi,

Is it possible to replicate a C linked list in VB?

I have a C DLL that requires a pointer to a linked list (the structure of which I have managed to replicate in VB) However will this work?

Thanks,

Rob

Dynamic Array? Linked List?
Hi there
Basically I want to save items in my Combo Box to an array. The problem is, I don't know how many items the Combo Box will have (it is only populated during run time). If I use array, I would have to declare it with a definite size, right? Do I have to use a linked list? Is there an easy way to solve this? I am not very good in VB so I would appreciate the simplest solution that you think I can use. Thanks

Linked List And Combo Boxes
Hi Everyone,

Another Quick question:
Is there a way to link a List box and Combo box to a database using the Data Enviroment?

Example:
I have an access table that contains a list of employee that I would like to have autofilled in a combo box on a form. I would like to have the combo box automatically look it up with out having to use the .additem method, since there are more then 5,000 emplyees.

Any iteas?
Thanks
BDS

Deleting Records In Linked List
OK i have a linked list that i'm trying to make changes to. My problem right now is that my SearchSinLinkList doesn't know what to do w/ a record that it's told to delete that doesn't exist. So another words flag is never set to false so it freezes i don't know how to set it up so that it just prints to a transaction record (print 6)


Code:
Private Sub LoadSearchSinLinkList()
ReDim Preserve myarray(120) As String
Head6
Do Until EOF(8) = True
Input #8, TransRecord
Key = Left(TransRecord, 4)
CarName8 = Mid(TransRecord, 5, 20)
QOH8 = Mid(TransRecord, 25, 3)
TC = Mid(TransRecord, 28, 1)
If TC = "D" Then
DeleteSinLinkList
ElseIf TC = "C" Then
ChangeSinLinkList
ElseIf TC = "A" Then
AddSinLinkList
Else
Print #6, Key & vbTab & CarName8 & vbTab & TC & vbTab & "Code Unknown"
End If
Loop
End Sub

Private Sub SearchSinLinkList()
ReDim Preserve myarray(120) As String
StartLoc = ListPointer
PrevLoc = 0
Flag = False
Do While Flag = False
If Val(Left$(myarray(StartLoc), 4)) = Key Then
Flag = True
StartLoc = StartLoc + 1
ElseIf Val(Left$(myarray(StartLoc), 4)) < Key Then
PrevLoc = StartLoc
If LLPointer(StartLoc) <> "999" Then
StartLoc = LLPointer(StartLoc)
Else
Flag = False
StartLoc = StartLoc + 1
End If
Else
Flag = False
StartLoc = StartLoc + 1
End If
Loop
End Sub


Private Sub DeleteSinLinkList()
SearchSinLinkList
If PrevLoc = 0 Then
ListPointer = LLPointer(StartLoc)
Print #6, Key & vbTab & CarName8 & vbTab & TC & vbTab & "Invalid Key"
Else
LLPointer(PrevLoc) = LLPointer(StartLoc)
Print #6, Key & vbTab & CarName8 & vbTab & TC & vbTab & "Deleted"
IdNum = "****"
CarName = "********************"
QOH = "***"
Price = "*********"
QOO = "***"
supplier = "*****"
End If
End Sub

Linked List (ActiveX Component?)
High!

I found several ways of implementing linked lists in VB6, but i think it would be best to use an ActiveX component written in C++. Does anyone know of such a thing?
Also, methods of implementing linked lists are very welcome, chances are there might be a better one than those that i found.

'Linked' List Boxes???*RESOLVED*
Is there a way to set the selected text of an item in a list box, I'm trying to get one list box to set the selected item of another box when the first is clicked on. Is that possible??? Or, how could I tell what the item with the same index as the first box selected index is. ie if box 1 is clicked on, what is the item in box 2 with the same index as the selected one in box1. Hope that makes sense

Any help apprieciated

Linked List For 3 Million Elements?
I need to make an *efficient* linked list that can store more than 5 million elements containing a long data type. 5 million is considered a small job, as large planned runs will involve up to 112 million elements.

Know of any source code (or links) for VB code that has the least memory overhead?

thx, -lp

Data Structures 1: Single Linked List
<h1><font color=orange>Data Structures 1: Single Linked List</font></h1><p>
This is my first go at a class module, and also my first bash at recursion, so I'm pleased with it.
Using the memory API - GlobalAlloc, GlobalLock, GlobalFree etc... this class will implement and maintain a single linked list. You can WriteNode(), ReadNode(), DeleteNode(), ClearList(), DebugPrintNode(), and more.

I probably haven't whacked out all the bugs, and no doubt it could be improved so if anyone spots anything, let me know.

For those that aren't sure what a linked list is, theres a short text file included explainin the basics.

Next in the data structures series - Queues and stacks....

Linked List Using User Defined Datatypes
i'm a third year engineering student..

i was asked to solve the water jug problem using vb by my teacher...

i tried using user defined data types to create a tree for the different states

this was the structure i used:-

private type node
gallon1 as integer
gallon2 as integer
children(4) as node
end type

it is giving me a runtime error at the statement "children(4) as node" saying that "CIRCULAR DEPENDENCIES BETWEEN MODULES"

can any body help me out...

i cant use class modules 'coz arrays can't be made public in class modules...

plz help me some one....plz...plz.... i just need to know the correct node structure

Combo/List Boxes Linked To A Database
Hi Guys

I am a complete newbie at being a newbie and in need of some help from you dear folk.

Im setting up a small application for a Computing Studies project in sixth form. Our aim is to make the software handle different data such as employee data, customer data and stock data for our chosen business. I chose a small music/games shop. I like to keep things basic... see.

Moving on: Ive been through my brain in 1,000 cycles searching for a different way to do an 'Add New Order' form but I can only see justice in using either a combo or a list box to display the different products in a stock table in an Access database. My problem is that Im unable to make the list or combo boxes display the different products inside the stock table. It will show one, then leave the rest blank. Ive tried binding them with a simple data control as well as an ADODC. Its just not working.

From what Ive seen Im about to get flamed for binding objects - but Im not serious programmer so it was the easiest way.

The question without the waffle is: Is it possible to link a combo/list box to a list of different products inside a table? Either using SQL code or bound controls?

If anyone understands what Ive just typed - I would seriously appreciate any bit of help I can grab.

TIA to you all

JG

Insertion Sort Using Linked List - Slow Performance - Why ?
Good day ! I have try to implement an insertion sort using Linked List in VB.

I tried to refer http://support.microsoft.com/default...;en-us;q166394

I try to compare both Insertion sort, one using Array another one using Linked List. Theoritically, the linked list method will be faster and have a shorter duration. But the result I got is almost 2x the time taken by the array method.

Why ?

Thanks a lot but really need it in urgent !

Below is the code that I am using.
classNode.cls
===========
Public pValue As Variant 'var to hold some data
Public pNext As classNode 'pointer to next node in list

classInsertionSort.cls
================
Private currentNode As New classNode
Private tempNode As New classNode
Private headNode As New classNode
Private previousNode As New classNode

'This sub accept a reference to the array which contain the generated value
Private Sub insertionSortWithLinkedList( ByRef insertionArray() As Variant)

Dim insertCountX As Integer
Dim insertionTemp As Variant

'Creates the dummy tail and dummy head
headNode.pValue = -99999
Set headNode.pNext = New classNode
Set currentNode = headNode.pNext
currentNode.pValue = 99999

'Point the linked list back to itself to indicate ending
Set currentNode.pNext = currentNode

For insertCountX = 0 To UBound(insertionArray) - 1
Set tempNode = New classNode
tempNode.pValue = insertionArray(insertCountX)

'Start from the first head node
Set currentNode = headNode

'Identify the location the temp value to put in
Do While currentNode.pValue < tempNode.pValue
Set previousNode = currentNode
Set currentNode = currentNode.pNext
Loop

'After the location is found, relinked the memory address
'Link tempNode with current node and previous node with
'tempnode
Set tempNode.pNext = currentNode
Set previousNode.pNext = tempNode
Next

End Sub

'This sub is the array insertion sort
Private Sub insertionSortWithArray( ByRef insertionArray() As Variant)
Dim insertCountX As Integer
Dim insertCountY As Integer
Dim insertionTemp As Variant

For insertCountX = 1 To UBound(insertionArray) - 1
insertionTemp = insertionArray(insertCountX)
insertCountY = insertCountX

Do While insertionTemp<insertionArray(insertCountY - 1)
insertionArray(insertCountY) = insertionArray(insertCountY - 1)
insertCountY = insertCountY - 1

If insertCountY = 0 Then
Exit Do
End If
Loop

insertionArray(insertCountY) = insertionTemp
Next
End Sub

Linked Access DB Runs Slow With Linked Tables
My db was running fine until I put all the data tables in a backend db and linked back to the front end. Then it went all slow on me. The back end is in the same directory as the front, so it's not on a different server. I removed any relationships declared in the backend and left the relationships defined in the front end.

Is there something I need to do to optimize my linking or is there maybe a setting I forgot to adjust?

Thanks,

Making List Twice?
Could someone tell me why this code is making my list twice? I do understand that it might be coming from opening and closing the file twice, but i do not know how to fix that.


Code:
Private Sub Command1_Click()
List1.AddItem Text1.Text
Dim fnum2 As Integer
Dim intLoop As Integer

fnum2 = FreeFile

Open "C:MMDCHackerlistfilesHlist.sbf" For Append As #fnum2
For intLoop = 0 To List1.ListCount - 1
Print #fnum2, List1.List(intLoop)
Next intLoop
Close #fnum2
End Sub

Private Sub mnuExit_Click()
Unload Me
End Sub

Private Sub mnuMS_Click()
Shell "C:program fileswizetmaplestorymaplestory.exe"
End Sub

Private Sub Form_load()
Dim fnum As Integer
Dim file_line As String


fnum = FreeFile
Open "C:MMDCHackerlistfilesHlist.sbf" For Input As fnum
Do While Not EOF(fnum)
Line Input #fnum, file_line
List1.AddItem file_line
Loop
Close #fnum
End Sub

Making A Variable List
i am doing an assignment in Visual basic but i need som help in how to compose a variable list and i also want some help with the coding in making a login screen work

Making A List With A Macro
Hi
I'm Trying to create a list with a macro,
i,m having trouble getting it to create a list.
I select a row on one sheet and try paste it into another row on a second sheet but it just keeps pasting over the top of the previously moved data.

the paste part of the macro looks like this

Sheet("sheet3").Select
Rows("21:200").Select
Selection.End (xlup).Select
ActiveCell.Offset(1,0).Select
ActiveSheet.Paste

The macro preforms sevral diffrent functions and the list is large thats why i've only shown the part i'm having problems with, i can show the full list if anyone needs to see it all to help.
I've used the above method before to create a list, however i was only copying the contents of a single cell not an entier row.
anyone got any ideas.

R

Making A List Box Ascending
any1 know a way of making a list box ascending through code. Like in league tables where the teams can change through the points i would like to do the same. can some1 plz help me. cheers ppl.

List Box Making It Variable...
Thanks Hack, It worked.
Well Now I have all the files in my list box and able to select all using properties. How to perform some action on all these files...

Making A List, Checking It Twice
So, if I want to assign the selected list item to a varialble, I would put what after the dot. I've been playing around for 10 minutes with this, that's too long.

somevariable = lstInterval.

Enumeration Vs Making A List
To me, when you enumerate, you make a list of specific items, like
enumerating controls in a form. Am I missing something? I mean is there
something more to the meaning of the term "enumeration" or "enumerate" (in
programming context) other than just sounding technical. i.e. is it more
than just making a list of items? Are they the same thing? Please excuse my
'dah' factor, but it is really bugging me.

Willam Roberts

Joy to the world

Making A Numbered List In A Label Box
I am trying to make a list appear in VB when I click a button. However, I dont know how to make a list appear in outline format without hitting "Enter" and, of course, this wont work in the programming code. So basically, I just need to know what the command is to start in a new line. Just for an example of what I want when I hit the button, I want all this to pop up at the same time:

1.yada yada
2.more stuff
3.another line of text
4.etc.

Thanks for any and all help.
Ross

Making A List Box Enabled But Inaccessible
I want to use a list box to track new entriies as they are added or removed, but I also want the user to not have any access to it either by the mouse or the keyboard. In short, the list box is to be read only. I simple solution is to disable it, but that dims it out and makes the entries hard to read. Encasing it in a frame and then disabling the frame is another alternative, but that dims out the frame caption and makes it hard to read.

Here's what I have come up with so far, using a command button to reposition the list index:

Code:
Dim ListPoint As Integer, MouseClick As Integer

Private Sub Command1_Click()
' Move List Index
With List1
If .ListIndex < .ListCount - 1 Then
.ListIndex = .ListIndex + 1
Else: .ListIndex = 0
End If
End With
End Sub

Private Sub Form_Load()
With List1
For I = 1 To 20
.AddItem Str$(I)
Next
.ListIndex = 0
End With
End Sub

Private Sub List1_Click()
With List1
If MouseClick Then ' Ignore and reposition
MouseClick = 0
.ListIndex = ListPoint
Exit Sub
End If
ListPoint = .ListIndex
End With
End Sub

Private Sub List1_KeyDown(KeyCode As Integer, Shift As Integer)
KeyCode = 0
End Sub

Private Sub List1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
MouseClick = Button
End Sub

My only complaint about the above code is that a mouse click on the list box temporarily moves the list index but then repositions it. Is there any better way to do this so that a mouse click on the listbox is totally ignored? Scrolling the list box with the mouse would be acceptable, but even that should probably be suppressed.

Making New Controls In List Format
This is going to be a little hard to explain, so read closely.

I have a topic watcher/creator for a forum. It can create, and then watch a topic. By watching, it get's the number of posts, users that posted, and displays each post.

What I want to do, is to be able to display each seperate post in a new label. Then, when the posts get bigger then the form, for it to use a scroll bar so you can scroll down to see the other posts. I'm not sure what control can handle this, that's why I am asking. Can anyone help me out with this idea? I can explain more if needed, thanks

Copyright 2005-08 www.BigResource.com, All rights reserved