SPONSORS:






User Tag List

Results 1 to 5 of 5
  1. #1
    Senior Member
    Join Date
    Jul 2001
    Posts
    147
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Getting text from Excel and putting it into a text field

    Hi can anyone help

    I have created an Excel Spreadsheet. From the Excel Spreadsheet, I want to get the contents of a cell and put it into a textfield on my windows application.

    I have setup the Excel following the document on James G. Soderborg, that works fine.

    However, I am have problems in Setting the Text into the text field.

    Find my code attached:

    [ ] // To tell DBTester what DB to connect to
    [ ] STRING sConnectString = "DSN=MWTDataBase;DBQ=H:\SilkTest\DataBase\MWTDataB ase.xls"
    [ ]
    [ ] // Connect to database and keep a reference to it
    [ ] HANDLE hDB = DB_Connect (sConnectString)
    [ ]
    [ ] // SQL command to be executed on the DB
    [ ] STRING sSQL = "SELECT `IndividualTax$`.Income, `IndividualTax$`.Deductions, `IndividualTax$`.Total"+
    " FROM `IndividualTax$` `IndividualTax$`"
    [ ]
    [ ] // Execute the SQL statement and keep a
    [ ] // refernce to the resulting table
    [ ] HANDLE hSQL = DB_ExecuteSQL (hDB, sSQL)
    [ ]
    [ ] // variables to hold data retrieved from the DB
    [ ] LIST OF ANYTYPE laData
    [ ]
    [ ] // Query result table and copy data into variable
    [-] while (DB_FetchNext (hSQL, laData))
    [ ] NewCalculation.Calcs.IndividualTax.WndAppWindow1.D ialogBox1.Client.SetFocus ()
    [ ] NewCalculation.Calcs.IndividualTax.WndAppWindow1.D ialogBox1.Client.SetText (laData[1])
    [ ] NewCalculation.Calcs.IndividualTax.WndAppWindow1.D ialogBox1.AllowableDeductions.SetFocus ()
    [ ] NewCalculation.Calcs.IndividualTax.WndAppWindow1.D ialogBox1.AllowableDeductions.SetText (laData[2])
    [ ] NewCalculation.Calcs.IndividualTax.WndAppWindow1.D ialogBox1.AllowableDeductions.TypeKeys ("<Tab>")
    [ ] // Print one record at a time to results file
    [ ] Print (laData)
    [ ]
    [ ] // Clean up and disconnect
    [ ] DB_FinishSQL (hSQL)
    [ ] DB_Disconnect (hDB)

    It gets the values fine out of Excel, but I can't seem to put them into a textfield.

    What am I doing wrong?


    ------------------
    Who Tests The Tester...
    Who Tests The Tester...

  2. #2
    Member
    Join Date
    Aug 2000
    Location
    Hyderabad,AP,India
    Posts
    80
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Getting text from Excel and putting it into a text field

    Friends,


    actually I am not very clear what exactly problem is...

    How about using SetPosition (1,1) instead of
    SetFocus ()


    Baseer

  3. #3
    Senior Member
    Join Date
    May 2001
    Location
    Lahore, Punjab, Pakistan
    Posts
    101
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Getting text from Excel and putting it into a text field

    The solution is very simple.
    just search Silk Test forum and you will get the solution
    This question has been posted for number of times.

    ------------------

  4. #4
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Getting text from Excel and putting it into a text field

    If you can't put the text in a text field in a non-excel place, can you tell us what error message(s) do you get?


    ------------------

  5. #5
    Senior Member
    Join Date
    Jul 2001
    Posts
    147
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Getting text from Excel and putting it into a text field

    I wasn't getting an error message.

    It wasn't taking the text from Excel an placing it into a text field. All it was doing was just putting it blank into the text field.

    Anyway, I worked it out.

    For some reason it didn't like me using SetText (), so instead I used TypeKeys (), and it works now...

    ------------------
    Who Tests The Tester...
    Who Tests The Tester...

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 07:45 PM.

Copyright BetaSoft Inc.