0

Hi :) I'm using winforms to try to make a GUI on Visual C++ 2005. Now one of the forms deals with a linked list (what's supposed to happen is that when a customer clicks the sign up button, a new customer object is appended to the end of the list). The problem is I know how to make linked lists in normal c++ (umm... like not managed, sorry I'm really bad with the terminology), but for some reason I can't define pointers in the forms. So I can't make a linkedlist, and I have no clue how to get around it.

Example:

customers * first;

gives the error C3699: '*':cannot use the indirection on type 'Ethicsprojectfinal::customers'

So I did this

customers ^first;
first=0;

I get: error C2446 no conversion from 'int' to 'Ethicsprojectfinal::customers ^'
So obviously it's not a pointer, and it can't point at null. And I'm completely lost. I guess my question is is there a way to use pointers in forms? And if not, how do you make linked lists with forms?

Thanks a lot!

3
Contributors
5
Replies
6
Views
8 Years
Discussion Span
Last Post by ddanbe
0

Forget about pointers here. Use a generic LinkedList object instead.
You don't know how it's implemented, but it has plenty of methods to feel confortable with. Pointers can still be used but in an unmanaged context.

0

Here...hope u can read it...:)

//##########################################
#pragma once

struct LinkList
{
	int a;
	LinkList *Link;
};

namespace "Link" {

	using namespace System;
        //....

        public ref class Form1 : public System::Windows::Forms::Form
	{
              //...
              private: LinkList *new_link;
              //...

              private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e)
	     {
                  //...
	          list = new LinkList;
		  list->a = 2;
                  //...
	     }
             //....
        };
}
//##########################################
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.