Passing Text From Class to Main Program

I am trying to write three separate strings from the class
file into three separate TEXT boxes within the main program. It
works using three separate functions. Is there a way to change the
code so it all can happen from within but one and the same function
in the class file.
package Edit
public class Texter
public var i:int;
public static var result:String;
public function Greeter()
public function sayHello():String
result = "This is the first idea I have. ";
return result;
public function sayGoodbye():String
result = "Here is the second idea, like. ";
return result;
public function sayHi):String
result = "Here is the third city disco. ";
return result;
Thanks,
BudHud

You can use a parametrized function which will display the
information according to your given data
like
public function saySomething(data:String):String
return data;
}

Similar Messages

  • How to sent text from my C# WinForm program to another program - where the cursore is

    hi
    how to sent text from my C# WinForm program to another program - where the cursore is
    for example: i have in my program label that contain "ABC" , when i press 'Z'
    the ABC will Appears where the cursore is standing.
    how to do it ?
    what to look for ?
    thanks

    Hi E_Gold,
    You'll need to:
    1) Bring the app to the front
    2) SendKeys to the app
    This code will send "ABC" to MS Word:
    using System.Runtime.InteropServices;
    private void Form1_Load(object sender, EventArgs e)
    // Send the keys 'ABC' to MS Word:
    SendKeysToApp("word", "ABC");
    private void SendKeysToApp(string appName, string keys)
    if (BringAppToFront(appName))
    SendKeys.Send(keys);
    [DllImport("User32.dll")]
    private static extern void SwitchToThisWindow(IntPtr hWnd, bool fAltTab);
    private bool BringAppToFront(string processName)
    IntPtr hWnd = HWnd(processName);
    if (hWnd != new IntPtr(0))
    SwitchToThisWindow(hWnd, true);
    return true;
    else
    return false;
    private IntPtr HWnd(string processName)
    IntPtr hwnd = new IntPtr(0);
    using (Process process = ProcessGet(processName))
    if (process != null)
    try
    IntPtr h = process.MainWindowHandle;
    hwnd = h;
    catch
    if (hwnd != new IntPtr(0))
    return hwnd;
    return hwnd;
    public Process ProcessGet(string processNameToGet)
    if (processNameToGet == "")
    return null;
    Process[] processes = Process.GetProcesses();
    foreach (Process process in processes)
    if (process.ProcessName.IndexOf(processNameToGet, StringComparison.CurrentCultureIgnoreCase) != -1)
    return process;
    return null;
    For info on sending special keys such as "Enter", so this page on MS website:
    SendKeys Class
    Hope this helps.
    Thanks, Andy

  • Pass Value from Excel to custom program

    Hello,
    I want to pass value from Excel to Custom Program being called in the Custom Integrator and i am using the Import in the Importer section but it is not getting passed.
    Please advise and i am on R12.1.3.
    Thanks

    Pl do not post duplicates - Concurrent Program Parameter

  • How to pass text from flash to html?

    how to pass text from flash to html?

    This is a wonderful sample i found online.
    pls run using a server so that it can display properly
    http://active.tutsplus.com/tutorials/actionscript/flash-html-javascript-externalinterface/

  • Cant return text from class

    Hi guys,
    I'm hopeing someone out there can help me out with a problem that has been bothering me for the last few days. Basically I can not get my class to return any text at all by calling the appropriate function, yet if I do a system.out.println() from within the class its self the text will be outputed to the console without a problem.
    Below is the threaded class I want to retrieve the text from:
    import java.io.*;
    import java.net.*;
    import java.util.*;
    public class SockThread implements Runnable{
         private String chatter;
         public String chatText;
         private String charText;
         private Thread runner;
         private Socket socktest;
         private PrintStream out;
         private BufferedReader in;
         public SockThread() {
              if (runner == null) {
                   runner = new Thread(this);
                   runner.start();
         public void run() {
              try {
                   this.connect();
              } catch (IOException ioe) {
         public void connect() throws java.io.IOException{
              String hostname = "efnet.xs4all.nl";
              int portnumber = 6669;
              this.socktest = new Socket(hostname, portnumber);
              this.out = new PrintStream(this.socktest.getOutputStream());
             this.in = new BufferedReader(new InputStreamReader(this.socktest.getInputStream()));
              this.out.print("user "+ "strangename" + " stranger irc : " + "Stranger");
              this.out.print("\n");
              this.out.print("nick " + "Shadwick");
              this.out.print("\n");
              Boolean eof = false;
                   try {
                        while (!eof) {
                             this.charText = in.readLine();
                                  if (this.charText == null){
                                       eof = true;
                                       socktest.close();
                                  } else {
                                       this.chatText = charText;
              } catch (IOException ioe) {
                   System.out.println("Its not working :( " + ioe);
         public void showStatus() {
              System.out.println(this.chatText);
    }And here is my main class:
    public class ChatConsole {
         public static void main(String[] arguments) {
              SockThread st = new SockThread();
              st.showStatus();
    }No matter if i try accessing the text via the showStatus() function or directly access the chatText variable i get nothing. I'm pretty sure i'm missing something thats stopping me from getting the text but I just cant see it. If anyone can help I'd greatly appreciate it.

    As you are creating another thread with the SockThread class, it runs independently from the main thread. So the SockThread Thread has probably not gotten to the part where it initiates the chatText var by the time the main thread calls the showStatus() method.
    To varify this, either do:
    put System.out.println("TEST"); in the show status method. If this prints then the var just hasnt been initiated yet.
    OR
    Use Thread.Sleep(2000); in the main method to make is sleep for a while to give the SocketThread Thread a chance to initiate the var.

  • How to pass text from print program to SAPSCRIPT

    Hi Friends ,
    I need to print this 4 line text on the invoice form between the INFO window and MAIN window . I created a new window in the form and included the text . using include command . The requirement is that if a certain condition is met in the print program then only this 4 line text should be printed on the form .
    Any suggestions .
    Thank you ,
    Hari

    Hi Naren ,
    Just to verify .
    I need to define something like this below in the print program ?
    data : v_flag type c .
    If customer = 'R' .
      v_flag = 'X'.
    PERFORM WRITE_FORM.
    endif.
    In the SAPFORM I defined a new var window "ADD_TEXT"
    IF v_flag = 'X'.
    INCLUDE Z_TEXT OBJECT TEXT ID ST LANGUAGE ES  PARAGRAPH EE
    ENDIF.
    Please let me know if it is correct and also about the write_form . What paramenters do i pass in the write_form ????
    Thanks for your help .
    Hari

  • Control is passed from subscreen to main program in MM01

    Hi All,
    In MM01, in additional data tab ,we have a subscreen.
    This subscreen has following fields
    sales org,distribution channel,division and zzpublisher,zzMedia.
    sales org,distribution channel,division are within chain, end chain and we have a module to make these field mandatory based on data enetered in zzmedia.Ex:zzmedia 45
    similary zzpublisher sould be  mandatory based on data entered on zzmedia(zzMedia =55.
    ) .This field is not within chain endchain.
    When we enter zzmedia 45, sales org ,dist channe and division are working correctly.
    whereas when we enter zzmedia =55 ,zzpublisher is becoming mandatory but at the same time I am getting standard popup i.e Do you want to save the data,
    YES  No Cancel..
    Can you let me know how to avoid calling the popup when we require to make zzpublisher madatory.
    note:all the module written to make fields mandatory are in PAI

    Let's see... if you call the subscreen9030  after 9020 PBO, then in the 9020 PAI you call it again, and the PBO for 9030 initializes the data, didn't you just wipe out what you have entered?

  • How to work on 2 open text files in one main program

    I write to one text file and then I close it. I then open another text file in the same "main" class but I cannot write to this file - I get the following error: "Exception in thread "main" java.util.NoSuchElementException".
    Here's the code with the line underlined, at which point the error above gets reported:
    import java.io.*;
    import java.util.*;
    public class TwoFileStudentMarks
    public static void main(String[] args) throws IOException
    PrintWriter stFile = new PrintWriter (new FileWriter ("stFil.txt"));
    Scanner kbd = new Scanner(System.in);
    int lineNum = 0;
    System.out.println("Type in a name: (ZZZ to stop)");
    String name = kbd.nextLine();
    while (!name.equalsIgnoreCase("ZZZ"))
    stFile.println(name);
    lineNum++;
    System.out.print("Input next name: (ZZZ to stop)");
    name = kbd.nextLine();
    stFile.close();
    kbd.close();
    PrintWriter tstFile = new PrintWriter (new FileWriter ("tstFil.txt"));
    kbd = new Scanner(System.in);
    for (int j=0; j<lineNum; j++)
    for (int i=0; i<3; i++)
    System.out.print("For student " + j + " enter test " + i + ": ");
    int tst = kbd.nextInt();
    tstFile.print(tst+" ");
    tstFile.println();
    tstFile.close();
    kbd.close();
    } // end main     
    } // end class

    Thank You for responding to my question. I am new to the forum. I have posted only ONE question since joining on Novemebr 5th, 2007. So I have a question. What are tags  and how does one include them in a question that one wishes to post to the forum?
    Secondly, my experience of Java is only about 10 months. So any advice, tips, replies are greatly appreciated and most welcome, so that I may continue to use this language.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • Passing Array from Class to JSP

    Hoi all,
    I am using MyEclipse Tomcat 4.1 and MySql
    I am trying to pass a 2D array from my struts framework action class to the forwarding action JSP.
    the Array is filled correctly, I check that by printing the values of the array as they are filled by my ResultSet into my console.
    but when I pass the Array to my JSP the value is null.
    I did the following in the class:
    request.setAttribute("Aray",aray);     and in the JSP i request the Attrebute as follows:
    String[][] ary =  request.getParameter("Aray"); Any help will be appreciated thx .

    request.setAttribute("Aray",aray);
    String[][] ary = request.getParameter("Aray");
    See the difference?

  • Crystal Reports 10, Want to pass values from subreports to main report

    Post Author: playmkr278
    CA Forum: General
    Is there a way to just share values out of subreports.
    The reason I ask is that I am having problems pulling the correct information in one subreport so I'd like to use 2 subreports to pull out Billable hours on one and Billed Hours on another and then add them together to display on the main report.

    Post Author: Jedit
    CA Forum: General
    Yep there is!
    In your sub report
    I the formula editor create a shared variable then create the same variable in your main report.
    EG
    IN your SUB
    Create new formular called tothrs etcu2026..
    whileprinting records;
    shared numbervar tothrs: sum({table.fieldname}&#93;
    In Your Main Report
    whileprinting records;
    shared numbervar tothrs
    this passes the value from your sub to the main, check help for different types of format as the one above is only for a number there are others for time & date etc..
    hope this helps!
    I have been doing a similar exercise myself but got stuck summing the parameter values in my main report, if you solve this let me know?
    Please see http://technicalsupport.businessobjects.com/cs/forums/thread/6210.aspx

  • Passing Array From Subreport to Main Report then Summing

    Hi,
    I am having troble passing an array from a sub report to the main repport.  I have managed to create the array, pass it and display it in the main report, however the first value of the array is displayed twice.  Here is the  formulae I have used:
    In the sub report:
    whileprintingrecords;
    shared stringvar str;
    str:=str{@value}","
    In the main report:
    whileprintingrecords;
    shared stringvar str;
    stringvar array arr;
    arr:=split(str,",");
    join(arr,",")
    Also, when I have managed to resolve the problem of the first value printing twice, I hope to change the array back to a number array and sum all of the values together.  I'm not too sure how to do this either.
    I hope you can help.
    Julie

    Ummm... Isn't Join(Split(str,","), ",") = str?  Why bother with the two extra lines of code?  Also, are you sure the subreport isn't creating the "duplicate first value"?  (I.e.  The data has the same value on two records, so it's being added twice?)
    Also if you're looking for the sum, why not create another shared variable and sum the value in the subreport as you're building the array (assuming you need the array for other purposes)?
    HTH,
    Carl

  • Passing values from subreport to main report

    Dear All,
           I have used shared values in my sub report and i want to use that shared variable in my main report in one of the formulas for average calculation but i see the values as 0.
    Can someone let me know what I am missing.
    Regards,
    Sonali

    Hi
    The most important thing to remember when using shared variables is that Crystal Reports must first evaluate the formula where the value is stored before evaluating the formula that retrieves the shared variable.
    For example if you want to pass a grand total from the subreport to do a calculation in the main report, follow these steps:
    1. In the subreport, create a formula similar to the one below:
    //@SubFormula
    //Stores the grand total of the
    //{Orders.Order Amount} field
    //in a currency variable called 'myTotal'
    WhilePrintingRecords;
    Shared CurrencyVar myTotal := Sum ({Orders.Order Amount})
    2. Place this formula in your subreport.
    3. In the main report, create a formula that declares the same variable name:
    //@MainFormula
    //Returns the value that was stored
    //in the shared currency variable called
    //myTotal in the subreport
    WhilePrintingRecords;
    Shared CurrencyVar myTotal;
    myTotal
    4. Place @MainFormula in a main report section that is beneath the section containing the subreport.
    NOTE:
    For the shared variable to return the correct value in the main report, you must place @MainFormula in a main report section that is beneath the section containing the subreport. This ensures Crystal Reports evaluates the @SubFormula before @MainFormula.
    One way to do this is to insert a section below the section containing the subreport, and place @MainFormula in this new sub-section:
    · On the 'Format' menu, click 'Section'.
    · On the 'Sections' list, click the section containing the subreport.
    · Click 'Insert' (at top of dialog box). This inserts an additional subsection.
    · Click 'OK' to return to the report, and insert @MainFormula into this new sub-section.
    The next time you preview the report, @MainFormula displays the value from the subreport. In this particular example, that value was the grand total of the {Orders.Order Amount} field.
    5. Once you have verified that @MainFormula is returning the correct value from the subreport, you can include this formula in other main report formulas, such as:
    //@NewFormula
    //includes data from subreport
    {@MainFormula} + Sum ({Customer.Last Year's Sales})
    · Place this formula in the same section as @MainFormula, or in a section further down on the report.
    You have now successfully shared data from a subreport with the main report.
    NOTE:
    This is not possible with On Demand Subreports in Crystal Reports since the report will not be processed until after clicking report.
    Regards
    Sourashree

  • How to pass data from report list to program?

    Hi all,
    I have displayed an internal table content in a list with some fields setting input on.
    For example,
    LOOP AT ITAB.
       WRITE: ITAB-MATNR.
       WRITE: ITAB-MAKTX INPUT ON.
       WRITE: ITAB-LABOR INPUT ON.
    ENDLOOP
    Suppose there are 4 entries in ITAB, user then changes the MAKTX, LABOR of any 3 entries.
    Now, I want to update ALL the fields values (MAKTX, LABOR) on the list to database even though some fields values have not been changed. How could I pass ALL the fields values (MAKTX, LABOR) from the screen to the program? Should I use the read line command?
    Please help. Thanks.

    It's been a while since I tried this, but I think it goes:
    do:
      READ LINE sy-index FIELD VALUE ITAB-MATNR INTO matnr.
      if sy0subrc <> 0.
        exit.
      endif.
    enddo.
    The ABAP know that you wrote itab-matnr, and READ LINE is able to get that variable back again.
    Rob

  • Passing information from an OCI C program back to jdev

    Hi,
    I need to write a C program to do some microarray analysis with data inside the Oracle database. (Actually someone else will write the program...) The analysis results will probably end up in a file somewhere. I can call the C program using the extproc feature of Oracle, but the C code will have to send back some information to me, such as the filename. I am contemplating how to get this return information.
    For instance, the C program could update the database with the return information and I could retrieve it from the database. Is there a better way to communicate between jdev and an external procedure?
    Thanks.
    Susan

    I have been able to accomplish this to an extent. Now I am following Muench "Using View Objects to Select Stored Function Results" to try and call the function and return a value from jdev. When I create the view object based on the extproc c language function call (which works perfectly from sqlplus command line), the test query is valid is fine... but when I run a test client against the application module, I get the ORA-28575 error.
    Any ideas? This is supposed to be a network related issue so is there a problem coming through a jdbc:thin connection?
    Thanks.
    Susan

  • Passing arguments into main program using eclipse

    If I want to pass a file into my Main program using "file redirection" I would do the following when running my program from the command prompt:
    C:\ MainProgram < inputfile.txt
    How do I do this using Eclipse SDK(WinXP)? I have investigated the options for passing in "Program Arguments" and still can't figure it out. Can anyone please help? What do I type in the Program Arguments text box?
    Thank you,
    Mark

    Well, input redirection is a shell thing, so Eclipse may not support it like that. (Maybe it does, somehow, but if it does it's just aping shell behavior for convenience.)
    What I'd suggest, is to create an option to your program to read a specified file. Maybe something like
    MainProgram -input intputfile.txt
    Then give that as an argument in Eclipse.
    If this is for testing purposes, another option is to create a test class, and hardcode the filename in there.

Maybe you are looking for