Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Apr 17th, 2006, 7:25 PM   #1
Twilight
Programmer
 
Join Date: Apr 2006
Location: Calgary, Alberta
Posts: 67
Rep Power: 3 Twilight is on a distinguished road
Linked List and List Boxes

In my spare time, I'm trying my hand with Visual C++, and what I want to do is have a linked list of Nodes containing string and int variables. I would then like a ListBox in the form to display the data in the nodes.

Could somebody be so kind as to help me out? I'm brand new to Visual and still trying to find my way around.
Twilight is offline   Reply With Quote
Old Apr 17th, 2006, 7:43 PM   #2
InfoGeek
Professional Programmer
 
InfoGeek's Avatar
 
Join Date: Jun 2005
Location: India, The great.
Posts: 435
Rep Power: 4 InfoGeek is on a distinguished road
We're here to help. Write some code and post here if you're having any problems. Be sure to read the "How to post a question" and "Forum Rules" thread.
__________________
PFO - My daily dose of technology.
InfoGeek is offline   Reply With Quote
Old Apr 17th, 2006, 8:28 PM   #3
Twilight
Programmer
 
Join Date: Apr 2006
Location: Calgary, Alberta
Posts: 67
Rep Power: 3 Twilight is on a distinguished road
Sigh, I suppose I should try and fail first :p

I guess what I really want to ask is whether there is a built in function to do it. If not I can probably work out a function to do it.

On top of that, what kind of variables can be assigned as text in a text box?

For example, I tried to do this:
int Item = 4500;
txtItem->Text = 4500;

And got an error about type mismatches, though it will work with strings.

Also, how can I access form items from a file other than Form.h? For instance, in my main code file, I went:
Form1::MyTextBox->Text = "something";

but I can't use the -> operator, or the :: operator.
Twilight is offline   Reply With Quote
Old Apr 18th, 2006, 4:52 AM   #4
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
Quote:
Originally Posted by Twilight
Sigh, I suppose I should try and fail first :p

I guess what I really want to ask is whether there is a built in function to do it. If not I can probably work out a function to do it.

On top of that, what kind of variables can be assigned as text in a text box?

For example, I tried to do this:
int Item = 4500;
txtItem->Text = 4500;

And got an error about type mismatches, though it will work with strings.
Pretty obvious, Text is of type string, so it will not accept an integer.
txtItem->Text = "4500".
Convert it back when needed.

Quote:
Originally Posted by Twilight
Also, how can I access form items from a file other than Form.h? For instance, in my main code file, I went:
Form1::MyTextBox->Text = "something";

but I can't use the -> operator, or the :: operator.
Where have you declared Form1?
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote
Old Apr 17th, 2006, 9:37 PM   #5
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Quote:
Sigh, I suppose I should try and fail first
Dam' right, we ain't your nannies. Incidentally, there is a current thread regarding a linked list. Go on over and read the forum's rules/FAQ, the "How to Post..." thread, and so forth. You will discover that you are supposed to invest a little effort in looking around before you jump all over our good natures and take our freebies.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Apr 17th, 2006, 10:47 PM   #6
Twilight
Programmer
 
Join Date: Apr 2006
Location: Calgary, Alberta
Posts: 67
Rep Power: 3 Twilight is on a distinguished road
Actually, I did search, and found nothing pertaining to my original question of using Linked Lists combined with Visual List Boxes.
Twilight is offline   Reply With Quote
Old Apr 18th, 2006, 12:41 PM   #7
Cache
Hobbyist
 
Join Date: Sep 2005
Posts: 266
Rep Power: 4 Cache is on a distinguished road
Quote:
Originally Posted by Twilight
Linked Lists combined with Visual List Boxes.
So, you're looking for a 'Visual Linked List Box' ? :p

BTW what the heck are "Visual List Boxes", and if you're using .NET wouldn't it nice to say so?
Cache is offline   Reply With Quote
Old Apr 19th, 2006, 1:54 AM   #8
Twilight
Programmer
 
Join Date: Apr 2006
Location: Calgary, Alberta
Posts: 67
Rep Power: 3 Twilight is on a distinguished road
I'd love to tell you, but to be honest I'm not really sure I am. It would seem probable I'm using .net though. I just downloaded Visual Studio Express Edition, and starting fiddling with forms and such.

As for a Visual List Box, I suppose it's fairly redundant, as it's just a ListBox.

Quote:
Where have you declared Form1?
VStudio did it for me (I think).

Right above where I tried that, I had:
Application::Run(gcnew Form1());

And I have a complete Form.h and such that Studio made for me.
Twilight is offline   Reply With Quote
Old Apr 19th, 2006, 6:20 AM   #9
nnxion
Programming Guru
 
nnxion's Avatar
 
Join Date: Jun 2005
Location: elemental plane
Posts: 1,429
Rep Power: 5 nnxion is on a distinguished road
If you want to work with normal C++ you can do so, like this.

I don't know anything of C++ .NET
__________________
"Employ your time in improving yourself by other men's writings, so that you shall gain easily what others have labored hard for."
-- Socrates
nnxion is offline   Reply With Quote
Old Apr 19th, 2006, 8:53 AM   #10
ChiHappens
Programmer
 
ChiHappens's Avatar
 
Join Date: Sep 2005
Location: Brevard, NC
Posts: 35
Rep Power: 0 ChiHappens is an unknown quantity at this point
Send a message via MSN to ChiHappens
Why not use the built in array types? The ArrayList would work fine. All you need to do is create an object that has an int and a string and then load them into the arraylist, cast them back to the class when you wanna use them.

Chi
__________________
http://www.starshipcombatsimulator.com
They mostly come at night...mostly.
ChiHappens is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 2:24 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC