# Get text from TextField



## SunnyMan (Jul 29, 2009)

Hi all, i need your help, i have simple project(cocoa app)







untitled.h:

```
#import <Cocoa/Cocoa.h>

@interface untitled : NSObject {
    IBOutlet id mylabel;
}
- (IBAction)ButtonClick:(id)sender;
@end
```

untitled.m:

```
#import "untitled.h"

@implementation untitled

- (IBAction)ButtonClick:(id)sender {
	
	[mylabel setStringValue:@"Test"];
}
@end
```

How I can get string value, from TextField. I click to the button([mylabel setStringValue"Test"]) and i need get value(my own value, not this static string "Test") from TextField and put in the Label(where "Test" right now)

Thx a lot.


----------



## heibert (Jul 31, 2009)

If your new to Cocoa/C++ you might want to go a different route.
For example BASIC. In FutureBASIC you write your code and can use Carbon NIB windows.  In REALbasic you design the interface and click on a button and put a little bit of code in the button to make it do something.  FutureBASIC converts the BASIC code to Objective C; REALbasic compiles Universal Binary and soon will add Cocoa Support.


----------



## heibert (Jul 31, 2009)

If your new to Cocoa/C++ you might want to go a different route.
For example BASIC. In FutureBASIC you write your code and can use Carbon NIB windows.  In REALbasic you design the interface and click on a button and put a little bit of code in the button to make it do something.  FutureBASIC converts the BASIC code to Objective C; REALbasic compiles Universal Binary and soon will add Cocoa Support.


----------



## heibert (Jul 31, 2009)

For FutureBASIC go to http://4toc.com/fb/index.htm
For REALbasic go to http://www.realsoftware.com


----------



## Mikuro (Aug 3, 2009)

Since you already know how to set up outlets and actions, this should be simple.

First, set up a new outlet (let's call it "myfield"), and connect it to the text field. Then just do something like this:
	
	



```
[mylabel setStringValue:[myfield stringValue]];
```


----------



## SunnyMan (Aug 5, 2009)

Thx guys for your help, I already done. Thx


----------

