Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
K

kkyeung

@kkyeung
About
Posts
3
Topics
2
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Newbie: About passing parameter into a form
    K kkyeung

    I have the following code, and I want to pass the variable test1 into the form, so that the form can read my test1 value. The var will be passed to SetParameter, a method under Form1. But I've encounted the following problem: error C2664: 'void System::Windows::Forms::TextBox::set_Text(System::String __gc *)' : cannot convert parameter 1 from 'int' to 'System::String __gc *' error C2039: 'SetParameter' : is not a member of 'System::Windows::Forms::Form' Form1.cpp main: int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { int test1; string line; System::Threading::Thread::CurrentThread->ApartmentState = System::Threading::ApartmentState::STA; ifstream iFile("test.txt"); if (!iFile) { //error msg return -1; } iFile >> test1; iFile.close(); Form *Form1 = new Form(); Form1->SetParameter(test1); //put parameter into form Application::Run(Form1); //run app return 0; } Form1.h: public __gc class Form1 : public System::Windows::Forms::Form { public: Form1() { InitializeComponent(); } void SetParameter(int t){ textBox1->Text = t; } protected: void Dispose(Boolean disposing)...... ..... ..... ..... Actually I dunno where should I put the SetParameter, and how to convert int "t" to __gc textbox text as shown in the method.(since compiling the method results the first error) Million thanks again.

    Managed C++/CLI help c++ tutorial

  • [urgent newbie] input streams problem with .NET
    K kkyeung

    I have a form called form1.h, and respectively form1.cpp. I have the following code: #include "stdafx.h" #include "Form1.h" #include <windows.h> #include <iostream> #include <fstream> using namespace fyp1; int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { System::Threading::Thread::CurrentThread->ApartmentState = System::Threading::ApartmentState::STA; ifstream iFile("test.txt"); Application::Run(new Form1()); return 0; } I wanna add ifstream into above so that I can read-in a file, then pass the parameter into Form1(). But how can I do that? (ignore the button problem, i don't need it now)The above code cannot be compiled. Thanks again. -- modified at 15:09 Thursday 4th May, 2006

    Managed C++/CLI csharp help question

  • [urgent newbie] input streams problem with .NET
    K kkyeung

    I'm now doing a project, and what I need to do is firstly read a txt file using i/o stream. I've include the lib and since I need to do it in the .NET form (header) and I want to make it such that when I click the button, it will do the file read-in. But I cannot add file declaration such things into the header, as there's no main func there. What should I do? Coz I wanna relate the file read-in to the button. Million thanks!!

    Managed C++/CLI csharp help question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups