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

Managed C++/CLI

 
GeneralRe: About Multiple Windows Forms Pin
savitri13-May-09 1:22
savitri13-May-09 1:22 
GeneralRe: About Multiple Windows Forms Pin
N a v a n e e t h13-May-09 2:20
N a v a n e e t h13-May-09 2:20 
QuestionRe: About Multiple Windows Forms Pin
savitri13-May-09 19:41
savitri13-May-09 19:41 
QuestionRe: About Multiple Windows Forms Pin
Mark Salsbery14-May-09 6:58
Mark Salsbery14-May-09 6:58 
AnswerRe: About Multiple Windows Forms Pin
N a v a n e e t h14-May-09 16:02
N a v a n e e t h14-May-09 16:02 
GeneralRe: About Multiple Windows Forms Pin
savitri14-May-09 19:20
savitri14-May-09 19:20 
GeneralRe: About Multiple Windows Forms Pin
N a v a n e e t h14-May-09 23:52
N a v a n e e t h14-May-09 23:52 
QuestionRe: About Multiple Windows Forms Pin
savitri15-May-09 21:20
savitri15-May-09 21:20 
Hi Navaneeth,

I am writing here code of form1 and form2.
form1.h
#pragma once

#include "AboutApp.h"
#include "LoginForm.h"
#using <mscorlib.dll>

//#pragma comment( lib, "user32.lib" )

namespace NewMDIApp {
	
	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;
	using namespace System::Runtime::InteropServices;

	/// <summary>
	/// Summary for Form1
	///
	/// 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 Form1 : public System::Windows::Forms::Form
	{
		        
	public:
		Form1(void)
		{
			InitializeComponent();
			//
			//TODO: Add the constructor code here
			//
		}

	protected:
#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)
		{
			// Form1
			// 
			this->AccessibleRole = System::Windows::Forms::AccessibleRole::MenuBar;
			this->AllowDrop = true;
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
			this->BackgroundImage = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"$this.BackgroundImage")));
			this->BackgroundImageLayout = System::Windows::Forms::ImageLayout::Stretch;
			this->ClientSize = System::Drawing::Size(1017, 700);
			this->Controls->Add(this->statusBar1);
			this->Controls->Add(this->statusStrip1);
		}
#pragma endregion
public:
[DllImport("user32.dll",EntryPoint="GetKeyState")]
//static int GetKeyState (int keycode);
static int GetKeyState(int keyCode); 
[DllImport("user32.dll",EntryPoint="keybd_event")]
static void keybd_event(Byte bVk, Byte bScan, UInt16 dwFlags, int dwExtraInfo); 
//[import("user32.dll", ExactSpelling=true)];
//public: System::short GetKeyState(int keyCode); 
public:  static LoginForm^ lgFrm=gcnew LoginForm;

private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
			 
			 this->UpdateKey();
			 AboutApp^ app=gcnew AboutApp(this);
			app->txtUsr->Text="Savitri";
		           app->Show();
		 }

AboutApp.h(Form2)
#pragma once
#using <mscorlib.dll>

namespace NewMDIApp {

	using namespace System;
	using namespace System::ComponentModel;
	using namespace System::Collections;
	using namespace System::Windows::Forms;
	using namespace System::Data;
	using namespace System::Drawing;
	
	ref class Form1;
	public ref class AboutApp : public System::Windows::Forms::Form
	{
	
	public:
		AboutApp(Form1^ frm)
		{
			
			InitializeComponent();
			frm1=frm;
			//
			//TODO: Add the constructor code here
			//
		}

	protected:
#pragma region Windows Form Designer generated code

		void InitializeComponent(void)
		{
			//Code goes here
		}
#pragma endregion
private: 
    System::Void textBox1_TextChanged();		  
public:
	Form1^ frm1;
	    			
private: System::Void btnLogin_Click(System::Object^  sender, System::EventArgs^  e) {
			 String ^username,^password;
			 username=txtUsr->Text->ToString();
			 password=txtPwd->Text->ToString();
			 MessageBox::Show(username);
			 MessageBox::Show(password);
			 if(username->Equals("Savitri") && password->Equals("Pramod"))
			 {
				 MessageBox::Show("SuccessFully Logged in");
				//if i used frm1->GetValues() function it will give error. like Form1 is undefined.
				 textBox1_TextChanged();
			 }
			 else
			 {
				 MessageBox::Show("Not valid UserName and Password");
			 }
		 }

AboutApp.Cpp
#include "StdAfx.h"
#include "AboutApp.h"
#include "Form1.h"
System::Void NewMDIApp::AboutApp::textBox1_TextChanged(){
	if(frm1 != nullptr)
	frm1->GetValues(txtUsr->Text,txtPwd->Text);
}

Please give me some hints to solve this problems.
Thanks in advance.

Regards,
Savitri P
QuestionCreating Windows Service VC++ 6.0 Pin
iamJayPatil11-May-09 18:52
iamJayPatil11-May-09 18:52 
QuestionDetermining if an inputted file name exists? Pin
TabascoSauce9-May-09 12:50
TabascoSauce9-May-09 12:50 
AnswerRe: Determining if an inputted file name exists? Pin
dybs9-May-09 13:04
dybs9-May-09 13:04 
GeneralRe: Determining if an inputted file name exists? Pin
TabascoSauce9-May-09 13:12
TabascoSauce9-May-09 13:12 
GeneralRe: Determining if an inputted file name exists? Pin
dybs9-May-09 13:20
dybs9-May-09 13:20 
GeneralRe: Determining if an inputted file name exists? Pin
TabascoSauce9-May-09 13:28
TabascoSauce9-May-09 13:28 
GeneralRe: Determining if an inputted file name exists? Pin
teejayem9-May-09 14:59
teejayem9-May-09 14:59 
GeneralRe: Determining if an inputted file name exists? Pin
TabascoSauce9-May-09 16:21
TabascoSauce9-May-09 16:21 
QuestionUsing buttons in Webbrowser (VS2005) Pin
Trollslayer9-May-09 11:02
mentorTrollslayer9-May-09 11:02 
QuestionRe: Using buttons in Webbrowser (VS2005) Pin
led mike11-May-09 4:27
led mike11-May-09 4:27 
AnswerRe: Using buttons in Webbrowser (VS2005) Pin
Trollslayer11-May-09 7:19
mentorTrollslayer11-May-09 7:19 
Question[Message Deleted] Pin
TabascoSauce8-May-09 15:56
TabascoSauce8-May-09 15:56 
AnswerRe: Saving values to a selection in a list box (I'm a noob) Pin
Mark Salsbery9-May-09 11:44
Mark Salsbery9-May-09 11:44 
QuestionWMI Win32_Service Pin
Jack Rong4-May-09 5:22
Jack Rong4-May-09 5:22 
AnswerRe: WMI Win32_Service Pin
Mark Salsbery4-May-09 7:16
Mark Salsbery4-May-09 7:16 
AnswerCross posting pile of garbage Pin
led mike4-May-09 9:25
led mike4-May-09 9:25 
QuestionHow to use C# Managed DLL into my VC++ Application (DLL) Pin
PankajB29-Apr-09 20:53
PankajB29-Apr-09 20:53 

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.