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!

Recommended Answers

All 5 Replies

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.

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;
                  //...
	     }
             //....
        };
}
//##########################################

Just trying to help...

OK! You got the right spirit.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.