how can i put a selected word from textbox into string or label?

poringgunner

Active member
Joined
Feb 23, 2014
Messages
42
Programming Experience
Beginner
hi.. how can i do that things?
exmple i have textbox or richtextbox that contain this:

#include<stdio.h>

int main();
{
int a,b;
int c;

printf("Enter two numbers: ");
scanf("%d, %d", &a,&b);

c = a + b;

printf("The sum of two numbers is: %d", c);

getch();
}


i want the int a,b; and int c; put into a label or string.. but i dont know how to do that.. plss help.
 

jmcilhinney

C# Forum Moderator
Staff member
Joined
Apr 23, 2011
Messages
3,141
Location
Sydney, Australia
Programming Experience
10+
When you select some text in a TextBox or RichTextBox control, you can access that text in code via the control's SelectedText property. That property already is a String, so you don't have to put anything anywhere. If you want to display any text in a Label then you assign a String containing that text to the Label's Text property.
 
Top Bottom