Click here to Skip to main content
15,902,835 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I wanna ask you that how can I display the value of a defined char in text box or anywhere else in windows form application,,net 3.0 frame work?
just like;
private: System::Void textBox1_TextChanged(System::Object^  sender, System::EventArgs^  e)
         {
             int i=35;
             textBox1->Text = i.ToString();
         }

just like in above example, it displays the value of integer, just like that i want to assign a char and display its value in textbox.
like;
 {
                    char a[10]="David";
                    textbox1->=Text=a;
}

This coding must be wrong, but I hope u understand my meaning, I want to display the value of char 'a' in text box.
Please help me out. I am a beginner and needs your help.
Posted
Updated 1-Feb-11 20:38pm
v2

C++
String name = "David";
textbox1->Text = name;


—SA
 
Share this answer
 
v3
Comments
Manas Bhardwaj 2-Feb-11 2:30am    
I might be wrong, but op wants to display the text 'David' and not 'a'. a is the variable name here
Sergey Alexandrovich Kryukov 2-Feb-11 3:57am    
OK than -- updated. Thanks for the note.
(Is that all useless?)

Sabih, please, do yourself and all of us a favor: read the manual before programming!
Please!
--SA
sabih toor 2-Feb-11 2:50am    
i m still not getting it right!!!
{
char a[10]="David";
TextBox1->Text = a[10] + String::Empty;
}
i tried this... but this displays a numeric value in textbox.... i want to display the full name in text box... plz plz help me.
Sergey Alexandrovich Kryukov 2-Feb-11 3:53am    
Full name will be Text = name (!!!). But not a[10], see my code, not the code in your comment above!
--SA
Sergey Alexandrovich Kryukov 2-Feb-11 3:58am    
Updated, based on your clarification.
Read about Control class and string class!
--SA
.text property takes string value and not an array.
You should rather do it like:

Textbox1.text = new string(a);
 
Share this answer
 
v2

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