Passing multiple variables types to Backgroundworker

Hello everybody ,
This question has been asked many times , but I will can't make it work, I want to pass (string , serial port object ,and form.label)
here is my code :
Public switch As String = "request"
Public sp1 As New IO.Ports.SerialPort
Public arg As New List(Of Object)
Private Sub Gsload()
arg.Add(sp1)
arg.Add(CObj(switch))
arg.Add(label1)
BackgroundWorker1.RunWorkerAsync(arg)
End Sub
Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
Dim arglist As List(Of Object) = TryCast(e.Argument, List(Of Object))
Dim sp1 As IO.Ports.SerialPort = CType(arglist(0), IO.Ports.SerialPort) getdata(arglist(0))
Dim swt As String = CStr(arglist(1))
getdata2(sp1,arglist(2).text)
End Sub
It is not working , I do not know why
thnx for your help :)
Hey :)

You didn't say what the problem is. I suspect the problem is that the elements in arglist as Objects and you want to treat them as particular types of object.
What does the getdata method expect as its argument? If it expects a SerialPort, you will need to change arglist(0) to SerialPort.
getdata(CType(arglist(0), IO.Ports.SerialPort))
The value you stored in arglist(2) was a Label. If you want to access the Label's properties, you will need to convert arglist(2) from Object to Label.
Dim myLabel as Label = CType(arglist(2), Label)
getdata2(CType(arglist(0), IO.Ports.SerialPort), myLabel.Text)
Hello , Thnx for your answer and sorry my question wasnt clear at all ,
My problem is that I cannot use the string like this :
Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
Dim arglist As List(Of Object) = TryCast(e.Argument, List(Of Object))
Dim sp1 As IO.Ports.SerialPort = CType(arglist(0), IO.Ports.SerialPort)
Dim swt As String = CType(arglist(1), String)
If swt = "request" Then
switchdmm(sp1, "Auto")
End If
e.Result = getdata(sp1)
End Sub
even if swt = "request" it always skip it and execute e.result = getdata(sp1)
Hey :)

Similar Messages

  • Outputting multiple variable types from single output vi

    Hello,
    I am trying to make a vi that takes some inputs (they are not too relevant to my problem) and has a single output.
    My problem is that I'd like the output variable type to be left unknown until runtime.
    For example, the vi will decide appropriately when to output an integer, string or double variable type.
    Furthermore, inside the vi, I need a way to select the appropriate variable type to send, hence I need a way to check the type of a variable (I don't really know how to do that either).
    Can someone give me some advice?
    Thanks
    David

    Data types are determined at compile time.  You cannot have a run-time decision for a data type.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Tsql stored procedure - passing multiple variables

    Hi,
    I have a dropdown field on a form that allows for multiple
    selects. When I process the form, I currently use CF to dynamically
    generate the sql WHERE clause creating as many AND statements as
    needed.
    I'm migrating to MS SQL 2005 and Stored Procedures on the db.
    I'm trying to create a stored procedure that effectively uses tsql
    to do what CF was doing previously (creating the WHERE clause).
    In the code below, I am passing a char(22) variable called
    Channel. The code below was my initial attempt at trying to create
    the WHERE clause. Most of the code is focused on extracting out the
    individual "Channel" entities. Any thoughts on how to pull this
    together would be GREATLY appreciated!
    I'm need help on the SELECT side, ultimately I'm selecting
    "regions", from "Syndicated", the WHERE is based on the "Channels"
    passed.
    Thanks,
    cfwild

    Hi,
    This was quite the adventure trying to figure this out. I
    learned quite a bit about tsql. Here is the final procedure:
    CREATE PROCEDURE dbo.uspSelectSyndicatedRegion
    @TablePrefix char(7),
    @Category varchar(100),
    @Channel varchar(2000)
    AS
    BEGIN
    SELECT DISTINCT S.Region
    FROM Syndicated S
    JOIN iter_charlist_to_tbl(@Channel, DEFAULT) M
    ON S.Channel = M.str
    UNION
    SELECT ''
    ORDER BY S.Region
    END

  • Passing multiple variable values through Start Pointer

    Hi,
    I have a company code variable in my BI query, at initial run of the VC model i want to exclude multiple  company codes through start pointer, how can i write exclude condition for multiple values through company code variable field value input in start pointer, I don't want to change my BI query.
    please help me on this
    Thanks in advance

    Hi
    This document will be usefull for you:
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/07134c67-0b01-0010-0493-b89287cf330f
    You should build string with following syntax and pass it to the start point:
    :[Value(End - optional)]:Operator:I (Includes) or E (Excludes)
    Available Operators:
    ·         EQ u2013 Equal to
    ·         GE u2013 Greater than or equal to
    ·         GT u2013 Greater than
    ·         LE u2013 Less than or equal to
    ·         LT u2013 Less than
    ·         BT u2013 Between
    For more help:
    http://help.sap.com/saphelp_nw70/helpdata/EN/44/4fc09c78ef4e35e10000000a1553f6/frameset.htm
    Good luck,
    Ola

  • ODI Using Axis2 Passing Multiple Variables

    Hi,
    We are using Axis2 in between a .Net web app to pass four parameters to an ODI scenario. I am using SOAPUI to remove the web app from the testing process. Everything is working well except for the fact that only the last variable in the XML is ever read and stored in the ODI scenario execution. Below is a sample of our XML variable setup. In the ODI scenario we declare each of the four variables in the first four steps of the package (which I read somewhere was the proper setup). Regardless, if I remove the last two variable in the XML then only the second variable "v_HFMI_Fiscal_Year" is stored properly and the first is ignored. Furthermore, if I remove the last variable then the third is stored properly and the first two are ignored. Can anyone help?
    <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope" xmlns:odi="xmlns.oracle.com/odi/OdiInvoke/">
    <soapenv:Header/>
    <soapenv:Body>
    <odi:invokeScenarioRequest>
    <odi:Variables>
    <odi:Name>HFMI_PROJECT.v_HFMI_UserID</odi:Name>
    <odi:Value>CORMSBY</odi:Value>
    <odi:Name>HFMI_PROJECT.v_HFMI_Fiscal_Year</odi:Name>
    <odi:Value>2008</odi:Value>
    <odi:Name>HFMI_PROJECT.v_HFMI_Fiscal_Period</odi:Name>
    <odi:Value>06</odi:Value>
    <odi:Name>HFMI_PROJECT.v_HFMI_Submission_Type</odi:Name>
    <odi:Value>BPY2</odi:Value>
    </odi:Variables>
    </odi:Command>
    </odi:invokeScenarioRequest>
    </soapenv:Body>
    </soapenv:Envelope>

    Rhian80 wrote:
    I would use Applescript to do everything but I'm the only Apple person on staff and if I get hit by a beer truck tomorrow, someone has to know how to do this stuff. I figure they have better odds of finding someone on staff who knows UNIX.
    Another option may be to write the whole thing as a shell script and use Pashua or Platypus to create a GUI around it.
    One warning about creating and running shell scripts from AppleScript: make sure you correctly escape any user-supplied values when assembling the shell script. The easiest way to do this is by using the text object's 'quoted form' property, like this:
    do shell script "/Users/labadmin/Desktop/labbuild.sh " & quoted form of RoomNumber & space & quoted form of StationNumber
    or, if your shell script expects the room and station numbers to be supplied as a single argument rather than two separate ones:
    do shell script "/Users/labadmin/Desktop/labbuild.sh " & quoted form of (RoomNumber & StationNumber)
    If you forget to do this, Very Bad Things can easily happen when the inputted text contains spaces or other 'special' characters, either by accident or intent, e.g.:
    set user_input to "; say Oops;"
    do shell script "echo My name is " & user_input
    Do a web search for 'injection attack' for more on the perils of failing to sanitize your inputs properly.
    Incidentally, the latest edition of Apress's Learn AppleScript, which I co-wrote, has an entire chapter devoted to combining AppleScript and Unix shell scripting, if you're new to this subject./self-plug

  • Apex Charts - Pass Multiple Variables & Using GROUP BY

    Hi, I'm using Apex 3.2.1 and have generated a chart with the following query -
    select NULL link, PROXY label, count(*) value
    from "INVENT_OWNER"."LMT_SPACE_EMAILS"
    where RESPONSE = 'NO'
    group by PROXY
    This works fine.
    I now want to link the 'PROXY' column to a new page but I can not get the query correct even if I use Apex to generate the chart query.
    Apex generates it as -
    select 'f?p=&APP_ID.:4:'||:app_session||'::::P4_REF,P4_PROXY:'||REF||','||PROXY||':' link, PROXY label, COUNT(REF) value
    from "INVENT_OWNER"."LMT_CHECKS"
    group by PROXY
    but this will not parse and I get the error 'ORA-00979: not a GROUP BY expression'
    Can anyone please help ?
    Thanks in advance

    I am currently working on my first chart creation in apex 4.
    I am creating a 3D bar chart that shows the '%Complete' by Project and by Task by Project Title.
    There is one Project for Project Title but there can be multiple Tasks for each Project Title.
    My first series is called project -- and the series query is:
    SELECT NULL LINK,
    "F**"."PROJECT_TITLE" LABEL,
    "F**"."%_COMPLETED" VALUE
    FROM "F**"
    where "F**"."PROJECT_LEVEL" = 'Project'
    This works fine and returns the % complete for each Project.
    But for the next series I use the series query below and it only returns one Task - even if there are mutiple tasks for the Project Title.
    SELECT NULL LINK,
    "F**"."PROJECT_TITLE" LABEL,
    "F**"."%_COMPLETED" VALUE
    FROM "F**"
    where "F**"."PROJECT_LEVEL" = 'Task'
    How do I show multiple tasks on the graph for each Project Title?
    Thanks,
    Joan

  • Passing multiple session values from cold fusion into a flash movie

    Hello all,
    I know that to pass multiple variables into a flash movie
    you could use the embed tag like this(with the & between each
    variable):
    <embed
    flashvars="variable1=value1&variable2=value2"
    ></embed>
    Now to pass a single session variable from coldfusion in i
    did the following; which worked:
    <embed
    src="ASdb.swf"
    FlashVars="UserName=<cfoutput>#session.userName#</cfoutput>"
    width="550" height="400" autostart="true">
    </embed>
    Note that i had to use the cfoutput tags to get the value
    stored in the variables. Now; i tried to do the same thing for two
    session variables and the second one does not get read in. Here was
    my code:
    <embed src="ASdb.swf"
    FlashVars="UserName=<cfoutput>#session.userName#</cfoutput>&testTypeID=<cfoutput>#session .testTypeID#</cfoutput>"
    width="550" height="400" autostart="true">
    </embed>
    Can someone please tell me what I am doing wrong? Thank you
    very much in advance.

    Hold on there was a little error: My final code that did not
    work was the following:
    <embed src="ASdb.swf"
    FlashVars="UserName=<cfoutput>#session.userName#</cfoutput>&testTypeID
    =<cfoutput>#session.testTypeID#</cfoutput>"
    width="550" height="400" autostart="true">
    </embed>

  • Sending multiple variable to flash

    I did the following in passing several multiple to flash
    PHP code
    <?php
         $d  = array();
         $p = array();
         $t = array();
         require_once('C:\xampp\htdocs\moodle\config.php');
        $data = $DB->get_records_sql('SELECT questiontext,id FROM {question}');
        foreach ($data  as $element)  {
        $d[] = $element->questiontext ;
        $p[] = $element->id;}
        echo "var1=".urlencode($d[1])."&var2=".urlencode($p[1]);
    ?>
    Actionscript code
    var myLoader:URLLoader = new URLLoader();
    myLoader.dataFormat = URLLoaderDataFormat.TEXT;
    var myRequest:URLRequest=new URLRequest("http://localhost/moodle/selectquestion.php");
    myLoader.load(myRequest);
    myLoader.addEventListener(Event.COMPLETE,onCompleteHandler);
    var myValue: String;
    var valuetwo: String;
    function onCompleteHandler(e:Event):void{
       myValue = e.target.data.var1;
                          valuetwo = e.target.data.var2;
       trace(myValue);
       trace(valuetwo);
    However, error shows in actionscript that
    ReferenceError: Error #1069: Property var1 not found on String and there is no default value.
    Is there anything wrong in my php code or in the actionscript? How should I pass multiple variable to flash?

    I can fix it now as I should add
    var myvariable: URLVariables = new URLVariables(e.target.data);      
    to my actionscript code and then
    myValue = myvariable.var1;
    valuetwo = myvariable.var2;
    trace(myValue);
    trace(valuetwo);
    I can then trace back.

  • Passing multiple single values in Customer Exit Variables

    Hi,
    I have one requirement to Pass multiple single values in Customer Exit Variable.
    If the user gives 2010 i need to get value previous fisacal year(2009),if its 2009, we need to get 2009.
    Just requirement is like how to pass multiple single values?
    Thanks.

    Hi..
    For this create a variable- Types of variable= Characteristics Value> Processing type as Customer Exit-->Reference Char as Fiscal year..
    Try this code..
        when 'xxxx'.
          DATA: lv_zp0003_month(2) TYPE n,
                  lv_zp0003_year(4) TYPE n.
          CLEAR: lv_zp0003_month, lv_zp0003_year.
          lv_zp0003_month = sy-datum+4(2).
          lv_zp0003_year = sy-datum(4).
    If the month is January the year is set to previous year
          IF lv_zp0003_month = '01'.
            lv_zp0003_year = lv_zp0003_year - 1.
           l_s_range-low = lv_zp0003_year.
    Else the year is set to actual
          ELSE.
            l_s_range-low = lv_zp0003_year.
          ENDIF.
          IF l_s_range-low = l_s_range-high.
            l_s_range-opt = 'EQ'.
          ELSEIF l_s_range-high IS INITIAL.
            l_s_range-opt = 'EQ'.
          ELSEIF l_s_range-low LT l_s_range-high.
            l_s_range-opt = 'BT'.
          ENDIF.
          l_s_range-sign = 'I'.
          APPEND l_s_range TO e_t_range.
    Hope this helps.
    Regards.
    AKG

  • Passing Session variable of DATE data type to opaque view filter

    Hi Everyone,
    Can you guys please help me in passing session variable of DATE data type in RPD's physical layer 'opaque view' filter for Oracle database
    I tried following syntax, syntax wise I didn't got getting any error, but at the same time this opaque view is not fetching any records as well. my session variable is "END_DATE" and its value is 1998/12/31:00:00:00(as shown in RPD session windows, datatype is DATETIME)
    SELECT AMOUNT_SOLD, CHANNEL_ID, CUST_ID, PROD_ID, PROMO_ID, QUANTITY_SOLD, TIME_ID FROM SH.SALES
    WHERE TIME_ID =TO_DATE( 'VALUEOF(NQ_SESSION.END_DATE)','MM/DD/YYYY')
    SELECT AMOUNT_SOLD, CHANNEL_ID, CUST_ID, PROD_ID, PROMO_ID, QUANTITY_SOLD, TIME_ID FROM SH.SALES
    WHERE TIME_ID = TO_DATE( 'VALUEOF(NQ_SESSION."END_DATE")','MM/DD/YYYY')
    SELECT AMOUNT_SOLD, CHANNEL_ID, CUST_ID, PROD_ID, PROMO_ID, QUANTITY_SOLD, TIME_ID FROM SH.SALES
    WHERE TRUNC(TIME_ID) = TO_DATE( 'VALUEOF(NQ_SESSION."END_DATE")','MM/DD/YYYY')
    In past, I was able to pass a session variable into a opaque view filter using DATEOF function, but that was in DB2.
    I appreciate your time and help

    Finally, I got right format. here it is
    to_date(substr('valueof(NQ_SESSION.END_DATE)',1,10), 'yyyy-mm-dd')
    and here is the source from where I got this information
    Using OBIEE Session Variables in Select Tables in the Physical Layer

  • Oracle BI Publisher - Passing multiple wildcard search to a bind variable

    Hi,
    Please help me in resolving the below mentioned issue:
    I have developed a report in oracle BI Publisher with a SQL query.
    While scheduling the report to run I used to pass mutilple parameters like CGAMSVC08,RLCSVC51
    If the pass the parameter with wildcard search like C% it works.
    When I pass two or more parameter values with wildcard search like C%,R% its not working.
    Could you please let me know how should I give the bind variable in the SQL query. Currently I'm paramater like the one shown below for passing multiple paramaters:
    Where (',' || :PRMRETRID || ',' like '%,'||RL.RETROFIT_ID|| ',%')
    Edited by: user1101445 on May 23, 2012 2:02 AM

    HI Tyler.
    Well, here's the latest.
    I found this little gem in the BIEE 10.1.3.3.3 Release Notes Documentation...
    This issue applies to Versions 10.1.3.3, 10.1.3.3.1, 10.1.3.3.2, and 10.1.3.3.3.
    Reports that use the BI Publisher data template as the data model may fail with the
    following error: "Data not defined."
    This error will occur if you defined a parameter in your data template but you do not
    pass a value to it via the user interface. If you do not specify this parameter in the "Parameters" section of the report definition that you created using the BI Publisher Edit Report interface, then you will receive the error.
    To work around this issue, either define the parameter in the Edit Report interface or remove the parameter from the data template.
    That bit is now working.
    Having set this up and using your guide it works if my SOAP parameters declaration passes a single value like this...
    <parameterNameValues>
    <item>
    <name>P_INVOICE_ID</name>
    <multiValuesAllowed>true</multiValuesAllowed>
    <values>
    <item>16641</item>
    </values>
    </item>
    </parameterNameValues>
    But if I try and pass two or more like this...
    <parameterNameValues>
    <item>
    <name>P_INVOICE_ID</name>
    <multiValuesAllowed>true</multiValuesAllowed>
    <values>
    <item>16641,18421</item>
    </values>
    </item>
    </parameterNameValues>
    BIP states "java.sql.SQLException: ORA-01722: invalid number"
    My SQL where clause is..
    <sqlStatement name="Q1">
    <![CDATA[select * from vw_invoice_summary
                   where invoice_summary_id IN (:P_INVOICE_ID)]]>
    </sqlStatement>
    And the BIP error records the parameter value as P_INVOICE_ID 16641,18421 (which are legit invoice IDs)
    In summary, works if I pass one invoice ID, fails if I pass two or more.
    Any ideas? Or do you reckon this is now a post for the BIP forum?
    Kind regards.
    Simon

  • Creation of Multiple Variables of same type at runtime

    Hi,
    I have a requirement in which I need to create multiple variables at run time . The variables should be TRPE REF TO CL_GENIOS_VARIABLE. The number of variables required will be determined at run time based on the number of materials in a Bill of material. We are using these variables for some calculations as GENIOS is a SAP given code to solve linear equations.
    Please help me on this. If some one can let me know how I can create field symbols dynamically with different name that will also help.

    *       CLASS lcl_genios DEFINITION
    CLASS lcl_genios DEFINITION.
       PUBLIC SECTION.
         METHODS : constructor.
         METHODS : create_model
                    IMPORTING
                      i_name TYPE genios_name,
                   create_variable
                      IMPORTING
                        i_type TYPE genios_variabletype DEFAULT if_genios_model_c=>gc_var_continuous
                        i_lowerbound TYPE genios_float DEFAULT 0
                        i_upperbound TYPE genios_float OPTIONAL
                        i_name TYPE genios_name.
       PRIVATE SECTION.
         DATA : lo_enviroment TYPE REF TO cl_genios_environment,
                lo_model TYPE REF TO cl_genios_model,
                lo_variable TYPE REF TO cl_genios_variable.
    ENDCLASS.                    "lcl_genios DEFINITION
    *       CLASS lcl_genios IMPLEMENTATION
    CLASS lcl_genios IMPLEMENTATION.
       METHOD constructor.
         lo_enviroment ?= cl_genios_environment=>get_environment( ).
       ENDMETHOD.                    "constructor
       METHOD create_model.
         lo_model = lo_enviroment->create_model( 'DUMMY' ).
       ENDMETHOD.                    "create_model
       METHOD create_variable.
         lo_variable = lo_model->create_variable( iv_type       = i_type
                                                  iv_lowerbound = i_lowerbound
                                                  iv_upperbound = i_upperbound
                                                  iv_name       = i_name       ).
       ENDMETHOD.                    "create_variable
    ENDCLASS.                    "lcl_genios IMPLEMENTATION
    DATA : lo_genios TYPE REF TO lcl_genios.
    START-OF-SELECTION.
       CREATE OBJECT lo_genios.
       lo_genios->create_model( 'DUMMY' ).
       lo_genios->create_variable( i_lowerbound = 1
                                   i_upperbound = 255
                                   i_name = 'DUMMY' ).
    You can create genios_variable like this.
    and change this :
    TYPES : Begin of lst_genios, 
                       genios TYPE REF TO cl_genios_variable, 
                    End of lst_genios. 
    like this :
    TYPES : Begin of lst_genios, 
                       genios TYPE REF TO lcl_genios, 
                    End of lst_genios. 
    or you can create your table as Kartik example.

  • Passing variable type c length 64

    I want to pass a variable of length 64 and char type
    Currently this is what I have, but it should be yvalues(64) type c.
    data: yvalues type c.
    perform fcc_values using yvalues.
    FORM fcc_values using xvalues type c.

    Hi,
    Not sure what you are looking for..
    But try this..You can use CHAR64 data element..
    DATA: yvalues TYPE CHAR64.
    PERFORM fcc_values USING yvalues.
    FORM fcc_values USING xvalues TYPE char64.
    ENDFORM.
    Thanks,
    Naren

  • What target property must be specified while passing a object type variable to child package in SSIS 2012

    What target property must be specified while passing a object type variable to child package in SSIS 2012???

    As shown below, there is variable strVar and it's Value property is selected. Likewise you have to select the property that you need to pass.
    Please refer:
    http://www.bidn.com/blogs/MikeDavis/ssis/155/passing-variable-values-from-parent-package-to-child-ssis
    -Vaibhav Chaudhari

  • How can i pass multiple values by a single variable to EXECUTE IMMEDIATE

    Hi All,
    I want to pass multiple values for where condition for execute immediate. Something Like this:-
    bold
    Declare
    v_cond varchar(1000);
    Begin
    v_cond := '''INR','USD'''; --(OPTION 1)
    v_cond := 'INR,USD'; --(OPTION 2)
    EXECUTE IMMEDIATE 'Delete from table where colm in (:v_cond)' using v_cond;
    END;
    bold
    I am using this into a procedure
    Now option 1 gives an error ie a syntax error (; expected or something like that)(I am sorry, i can't tell the exact error here as i am not in the office right now)
    and option 2 makes the procedure execute but obviously doesn't delete the records, as it takes the whole as one.
    Please Help
    Regards
    Neeraj Bansal

    See the links containing examples under
    *7. List of values in an IN clause?*
    SQL and PL/SQL FAQ
    from the SQL and PL/SQL FAQ.

Maybe you are looking for

  • Routine in infopackage for selection

    I am writing an ABAP routine in an infopackage to select data upto a certain year. I want to load data for all the years upto 7 years ago. However, if I leave the l_t_range-low blank, the infopackage throws an error when I run it saying invalid date

  • ESS Travel Document attachment functionality

    Dear Forumites, We are planning to Implement Travel application in ESS, client's requirement is to upload scanned document in travel expense and report application which should be available for the manager to approve\Reject. As per my understanding,

  • Bonjour is MISSING!

    My MacBook got formatted and now I can't seem to find Bonjour anywhere. I need it to print wirelessly. Is there somewhere I can download it from or is there another way to print using a shared printer? Thanks...

  • Workflow Not Working

    Hi All, My custom workflow is not working in the QA system but is working perfectly in the DEV system. Any suggestions as to what the problem might be? The Business object being used (BUS2012) is not even appearing in the SWEL trace. Thanks in advanc

  • Getting attachments and emails need serious help!!

    I am not sure if I am doing this right, but I am trying to receive emails from gmail, and I am having some serious problems. For some reason I get four emails and then I get a null exception. I have been through my code a dozen times and I cannot fin