Click here to Skip to main content
15,915,770 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: update listbox?? Pin
Thilek9-Feb-09 18:02
Thilek9-Feb-09 18:02 
GeneralRe: update listbox?? Pin
Mark Salsbery9-Feb-09 18:11
Mark Salsbery9-Feb-09 18:11 
GeneralRe: update listbox?? Pin
Thilek9-Feb-09 18:23
Thilek9-Feb-09 18:23 
GeneralRe: update listbox?? Pin
Mark Salsbery9-Feb-09 18:27
Mark Salsbery9-Feb-09 18:27 
GeneralRe: update listbox?? Pin
Mark Salsbery9-Feb-09 18:16
Mark Salsbery9-Feb-09 18:16 
GeneralRe: update listbox?? Pin
Thilek9-Feb-09 18:31
Thilek9-Feb-09 18:31 
GeneralRe: update listbox?? Pin
Mark Salsbery9-Feb-09 18:40
Mark Salsbery9-Feb-09 18:40 
GeneralRe: update listbox?? Pin
Thilek9-Feb-09 18:44
Thilek9-Feb-09 18:44 
below is the full coding of my form :-

#pragma once

#include "Mainmenu.h"
#include "Scanner.cpp"

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


namespace trialcpp {

	/// <summary>
	/// Summary for Autoscanner
	///
	/// WARNING: If you change the name of this class, you will need to change the
	///          'Resource File Name' property for the managed resource compiler tool
	///          associated with all .resx files this class depends on.  Otherwise,
	///          the designers will not be able to interact properly with localized
	///          resources associated with this form.
	/// </summary>
	public ref class Autoscanner : public System::Windows::Forms::Form
	{
	public:
		Autoscanner(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

	protected:
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		~Autoscanner()
		{
			if (components)
			{
				delete components;
			}
		}
	private: System::Windows::Forms::Label^  label1;

	private: System::Windows::Forms::Button^  start_button;
	private: System::Windows::Forms::Button^  close_button;
	protected: 

	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->label1 = (gcnew System::Windows::Forms::Label());
			this->start_button = (gcnew System::Windows::Forms::Button());
			this->close_button = (gcnew System::Windows::Forms::Button());
			this->SuspendLayout();
			// 
			// label1
			// 
			this->label1->AutoSize = true;
			this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
				static_cast<System::Byte>(0)));
			this->label1->Location = System::Drawing::Point(22, 22);
			this->label1->Name = L"label1";
			this->label1->Size = System::Drawing::Size(176, 16);
			this->label1->TabIndex = 0;
			this->label1->Text = L"Scanning.... Please Wait";
			// 
			// start_button
			// 
			this->start_button->Location = System::Drawing::Point(324, 231);
			this->start_button->Name = L"start_button";
			this->start_button->Size = System::Drawing::Size(75, 23);
			this->start_button->TabIndex = 2;
			this->start_button->Text = L"Start";
			this->start_button->UseVisualStyleBackColor = true;
			this->start_button->Click += gcnew System::EventHandler(this, &Autoscanner::start_button_Click);
			// 
			// close_button
			// 
			this->close_button->Location = System::Drawing::Point(405, 231);
			this->close_button->Name = L"close_button";
			this->close_button->Size = System::Drawing::Size(75, 23);
			this->close_button->TabIndex = 3;
			this->close_button->Text = L"Close";
			this->close_button->UseVisualStyleBackColor = true;
			this->close_button->Click += gcnew System::EventHandler(this, &Autoscanner::close_button_Click);
			// 
			// Autoscanner
			// 
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->ClientSize = System::Drawing::Size(515, 266);
			this->Controls->Add(this->close_button);
			this->Controls->Add(this->start_button);
			this->Controls->Add(this->label1);
			this->Name = L"Autoscanner";
			this->StartPosition = System::Windows::Forms::FormStartPosition::CenterScreen;
			this->Text = L"Sparta AV : Auto Scanning";
			this->ResumeLayout(false);
			this->PerformLayout();

		}
#pragma endregion
	private: System::Void close_button_Click(System::Object^  sender, System::EventArgs^  e) {	 
				 Application::Exit();
			 }
private: System::Void start_button_Click(System::Object^  sender, System::EventArgs^  e) {     
 // Create an instance of the ListBox.
   ListBox^ listBox1 = gcnew ListBox;

   // Set the size and location of the ListBox.
   listBox1->Size = System::Drawing::Size( 400, 160 );
   listBox1->Location = System::Drawing::Point( 50, 50 );

   // Add the ListBox to the form.
   this->Controls->Add( listBox1 );

   // Set the ListBox to display items in multiple columns.
   listBox1->MultiColumn = false;

   // Set the selection mode to multiple and extended.
   listBox1->SelectionMode = SelectionMode::MultiExtended;
   // Shutdown the painting of the ListBox as items are added.
   listBox1->BeginUpdate();


   	vector<wstring> files;
	wstring directory =(L"C:\\Windows");		
	if (ListFiles(directory, L"*", files)) 
	{    
		for (vector<wstring>::iterator it = files.begin(); it != files.end(); ++it)     
		{        
			int index = listBox1->Items->Add(String::Concat(gcnew String(it->c_str())));        
			listBox1->SelectedIndex = index;        
			listBox1->Update(); 
			Application::DoEvents();
		}
	}
			  listBox1->EndUpdate();
   

   #if defined(DEBUG)
   // Display the second selected item in the ListBox to the console.
   System::Diagnostics::Debug::WriteLine( listBox1->SelectedItems[ 1 ] );

   // Display the index of the first selected item in the ListBox.
   System::Diagnostics::Debug::WriteLine( listBox1->SelectedIndices[ 0 ] );
   #endif
 }
};
}


Did i miss anything in the form ya ??
GeneralRe: update listbox?? Pin
Mark Salsbery9-Feb-09 20:41
Mark Salsbery9-Feb-09 20:41 
GeneralRe: update listbox?? Pin
Thilek9-Feb-09 21:59
Thilek9-Feb-09 21:59 
GeneralRe: update listbox?? Pin
Mark Salsbery10-Feb-09 5:53
Mark Salsbery10-Feb-09 5:53 
GeneralRe: update listbox?? Pin
Thilek10-Feb-09 5:57
Thilek10-Feb-09 5:57 
GeneralRe: update listbox?? Pin
Thilek10-Feb-09 6:17
Thilek10-Feb-09 6:17 
AnswerRe: update listbox?? Pin
N a v a n e e t h9-Feb-09 15:04
N a v a n e e t h9-Feb-09 15:04 
QuestionPass data between forms Pin
liverpoolfan8-Feb-09 8:11
liverpoolfan8-Feb-09 8:11 
AnswerRe: Pass data between forms Pin
N a v a n e e t h8-Feb-09 15:23
N a v a n e e t h8-Feb-09 15:23 
QuestionProblem showing an existing form called from another existing form Pin
regnwald6-Feb-09 15:42
regnwald6-Feb-09 15:42 
AnswerRe: Problem showing an existing form called from another existing form Pin
N a v a n e e t h6-Feb-09 15:55
N a v a n e e t h6-Feb-09 15:55 
GeneralRe: Problem showing an existing form called from another existing form Pin
regnwald6-Feb-09 17:08
regnwald6-Feb-09 17:08 
GeneralRe: Problem showing an existing form called from another existing form Pin
N a v a n e e t h7-Feb-09 2:30
N a v a n e e t h7-Feb-09 2:30 
GeneralRe: Problem showing an existing form called from another existing form Pin
regnwald7-Feb-09 13:17
regnwald7-Feb-09 13:17 
Questiononline tic tac toe Pin
staticv6-Feb-09 4:30
staticv6-Feb-09 4:30 
AnswerRe: online tic tac toe Pin
«_Superman_»6-Feb-09 16:45
professional«_Superman_»6-Feb-09 16:45 
Questionconnecting to mysql in a remote location.. Pin
Thilek5-Feb-09 5:33
Thilek5-Feb-09 5:33 
AnswerRe: connecting to mysql in a remote location.. Pin
led mike5-Feb-09 6:37
led mike5-Feb-09 6:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.