Hello All,
Currently I am working on an GUI using a tutorial video. In video when tutor types n = System::Convert:: , after :: a bunch of options appear like n = System::Convert::ToInt32. However, when I type same phrase n = System::Convert:: after :: no option appears. How can I activate the program to see these options after :: ?

Thank for helps,

Did you create your project as a CLR project? System::Convert is part of the .Net framework, and only .Net programs (which in C++ means Common Language Runtime programs) can use those classes.

Also, did you make sure to include the necessary headers?

Edited 4 Years Ago by Schol-R-LEA: n/a

Yes it is a CLR. As a starting point I tried to write a simple GUI for factorial calculation. My code is shown below. When I type codes I need see what other options after :: . I also included headers as shown in the code.

#include <windows.h>
#include <stdlib.h>
#include <string.h>
#include <tchar.h>
#pragma once

namespace fact_deneme {

	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;

	/// <summary>
	/// Summary for Form1
	/// </summary>
	public ref class Form1 : public System::Windows::Forms::Form
	{
	public:
		Form1(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~Form1()
		{
			if (components)
			{
				delete components;
			}
		}
	private: System::Windows::Forms::TextBox^  number_ent;
	protected: 
	private: System::Windows::Forms::Button^  calculate;
	private: System::Windows::Forms::Label^  the_result;

	private:
		/// <summary>
		/// Required designer variable.
		/// </summary>
		System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		void InitializeComponent(void)
		{
			this->number_ent = (gcnew System::Windows::Forms::TextBox());
			this->calculate = (gcnew System::Windows::Forms::Button());
			this->the_result = (gcnew System::Windows::Forms::Label());
			this->SuspendLayout();
			// 
			// number_ent
			// 
			this->number_ent->Location = System::Drawing::Point(21, 23);
			this->number_ent->Name = L"number_ent";
			this->number_ent->Size = System::Drawing::Size(69, 20);
			this->number_ent->TabIndex = 0;
			// 
			// calculate
			// 
			this->calculate->Location = System::Drawing::Point(27, 64);
			this->calculate->Name = L"calculate";
			this->calculate->Size = System::Drawing::Size(86, 24);
			this->calculate->TabIndex = 1;
			this->calculate->Text = L"Calculate";
			this->calculate->UseVisualStyleBackColor = true;
			this->calculate->Click += gcnew System::EventHandler(this, &Form1::calculate_Click);
			// 
			// the_result
			// 
			this->the_result->AutoSize = true;
			this->the_result->Location = System::Drawing::Point(26, 124);
			this->the_result->Name = L"the_result";
			this->the_result->Size = System::Drawing::Size(42, 13);
			this->the_result->TabIndex = 2;
			this->the_result->Text = L"Answer";
			// 
			// Form1
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(284, 262);
			this->Controls->Add(this->the_result);
			this->Controls->Add(this->calculate);
			this->Controls->Add(this->number_ent);
			this->Name = L"Form1";
			this->Text = L"Factorial Calculator";
			this->ResumeLayout(false);
			this->PerformLayout();

		}
#pragma endregion
		int n;
		int result;
		int k;
	private: System::Void calculate_Click(System::Object^  sender, System::EventArgs^  e) {
				
				 n = System::Convert::ToInt32(this->number_ent->Text);
				 result = 1;
				 for (k=2;k<=n;k++)
					 result = result*k;
				 this->the_result->Text = System::Convert::ToString(result);
			 }
	};
}

I just figured out that Intellisense is not supproted in VS 2010. That is the problem. I think I will have to install VS2008.

This article has been dead for over six months. Start a new discussion instead.