Click here to Skip to main content
15,790,267 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I m stuck with the windows form application "form1.h" where i want to pass text values accepted in textbox this->textbox1->text to "filename.cpp" file for authentication purpose

plz help me out ..

C++
TextBox^ textBox1 = gcnew TextBox;
textBox1->Text = "Welcome!";


And i'm using MOF code for authentication

C++
hres = pSvc->ExecQuery(
       bstr_t("WQL"),
       bstr_t("SELECT UserName,Password,Uid FROM HLDS where UserName='vinod'"),
       WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
       NULL,
       &pEnumerator);


Where the this->textbox1->text value accepted from FORM1 has to be substituted in the place of "vinod".
Posted
Updated 22-Mar-11 11:51am
v6

1 solution

Doesn't the += operator work?

C++
   string s = "SELECT UserName,Password,Uid FROM HLDS where UserName='";
   s += this->textbox1->text;
   s += "'";
hres = pSvc->ExecQuery(
   bstr_t("WQL"),
   bstr_t(s),
      WBEM_FLAG_FORWARD_ONLY | WBEM_FLAG_RETURN_IMMEDIATELY,
      NULL,
      &pEnumerator);
 
Share this answer
 
v2
Comments
Vinayak Pingale 23-Mar-11 8:37am    
no sir += operator dont work here thanks for ur help

plz tell me how to declare a global string i've tried but it gives error to me
static System::String^ str;
Henry Minute 23-Mar-11 8:44am    
Take a look at the following article from here on Code Project ->http://www.codeproject.com/KB/mcpp/cpptomancpp.aspx#EX3. Particularly the section on managed strings.

Hope it helps.
Henry Minute 23-Mar-11 9:08am    
I have found two more articles that may help you.
http://www.codeproject.com/KB/mcpp/OrcasMarshalAs.aspx?msg=3823860#xx3823860xx
http://www.codeproject.com/KB/string/StringConvertor.aspx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900