ListPicker selection changed issue in Windows Phone - c#-4.0

I have binded listpicker in OnNavigatedTo event,
and I have an event of "listPickerSelectionChanged", but problem is that even I have not selected the item from listPicker, the "listPickerSelectionChanged" event called and error occurs, how to prevent it?

Check whether you have set the SelectedIndex value to 0 it triggers the Selection changed event even before the Databinding, So as no data is avilable at the 0th index it throws error
If set to 0 change it to -1 ,
If not please specify the error being thrown

"Object Reference not set to an instance of Object" , Some value it captured null at the time of execution, without code reference can't get into any solution
Debugging may help you out.

Related

Access the return value of the DELETE (Worksheet) dialog

MSDN says that the worksheet's Delete method returns True or False depending upon how the user responded to the confirmation alert. In my version of 2013 Excel this doesn't work. Debug.Print Sheet1.Delete gives me a syntax error message, like "Function expected".
I don't want to suppress the alert. But if the user did cancel the deletion I would like to know about it. In fact, the way MSDN describes the action is just what I need. How does this work in the version of Excel I have?
It seems that the user's response to the Delete dialog's question isn't available as advertised. Therefore I used the logic that a deleted object shouldn't exist anymore to obtain the same True/False information.
WsLib.Delete
On Error Resume Next
Set Rng = WsLib.Cells(1, 1)
If Err = 0 Then
Debug.Print "WsLib wasn't deleted"
End If
Err.Clear
In this code snippet WsLib is a worksheet. Application alerts are not suppressed. The attempt to set Rng will fail if the worksheet was deleted. Hence, if no error occurs the deletion was halted.
Before this I tried the expression WsLib Is Nothing to return False if the user pressed Cancel in the alert dialog. Unfortunately that didn't work because Is Nothing tests the variable, not the object.

selectContextMenuItem method returning "The method got an invalid argument"

I'm trying to sort a table in SAP in Blue Prism. The code previously worked fine but now I'm getting the following error message when I try to sort the table by context menu item.
The method got an invalid argument
I've tried passing a variety of values to the selectContextMenuItem method: "&SORT_DSC", "&SORT_ASC", "&COL_INV"...all yield the same error.
Dim SAPGuiAuto as Object
Dim SAPApp as Object
Dim SAPCon as Object
Dim session as Object
Dim Table as Object
SAPGuiAuto = Microsoft.VisualBasic.Interaction.GetObject("SAPGUI")
SAPApp = SAPGuiAuto.GetScriptingEngine
SAPCon = SAPApp.Children(0)
session = SAPCon.Children(0)
Table = session.findById("/app/con[0]/ses[0]/wnd[0]/usr/cntlGRID1/shellcont/shell")
Table.setCurrentCell("-1", "LMENGEIST")
Table.selectColumn("LMENGEIST")
Table.contextMenu
Table.selectContextMenuItem("&SORT_DSC")
I expect the column I've selected to be sorted in descending order.
Thanks in advance for any help you can provide.
I know this is an old question but I just started receiving this same error in my C# Console Application (.NET Framework v4.6) after months of the program running autonomously. The only difference is that I was attempting to select a Layout Variant using the filter. Additionally, the application only failed when I ran it as a scheduled task.
First, I did as Sandra suggested and executed the action manually. Whilst doing so, I used SAP's script recording feature to find out if the script used a different argument. I found that the script still used the same argument ("&FILTER"); but I also noticed that the table took a half second to initialize. So I added a few Thread.Sleep() - one after the button click (to give the Variant Select window time to initialize) and one after clicking the context menu (to give the menu time to initialize) - and now, my program now runs as smoothly as it did previously.
//Execute Report
((GuiMainWindow)SAPActive.SAPsession.FindById("wnd[0]")).SendVKey(8);
//Change Layout
((GuiButton)SAPActive.SAPsession.FindById("wnd[0]/tbar[1]/btn[33]")).Press();
Thread.Sleep(2000);
((GuiGridView)SAPActive.SAPsession.FindById("wnd[1]/usr/ssubD0500_SUBSCREEN:SAPLSLVC_DIALOG:0501/cntlG51_CONTAINER/shellcont/shell")).CurrentCellRow = -1;
((GuiGridView)SAPActive.SAPsession.FindById("wnd[1]/usr/ssubD0500_SUBSCREEN:SAPLSLVC_DIALOG:0501/cntlG51_CONTAINER/shellcont/shell")).SelectColumn("VARIANT");
((GuiGridView)SAPActive.SAPsession.FindById("wnd[1]/usr/ssubD0500_SUBSCREEN:SAPLSLVC_DIALOG:0501/cntlG51_CONTAINER/shellcont/shell")).ContextMenu();
Thread.Sleep(2000);
((GuiGridView)SAPActive.SAPsession.FindById("wnd[1]/usr/ssubD0500_SUBSCREEN:SAPLSLVC_DIALOG:0501/cntlG51_CONTAINER/shellcont/shell")).SelectContextMenuItem("&FILTER");
The error message The method got an invalid argument is very specific to SAP GUI Scripting methods, and can be recognized by the missing word has (before got).
It's a general purpose message which is sent when a method of SAP GUI Scripting has an argument which doesn't correspond to an expected value.
In your case, it would probably mean that the item &SORT_DSC does not exist in the context menu. Make sure that if you execute the action manually in the SAP GUI, you see this context menu and the option to sort in descending order.
NB: for information, this message may occur in a variety of other SAP GUI functions, for instance with fileID = application.utils.openfile("file-name.log"), just because the character "-" is not allowed in the file name.

This row was already applied and cannot be modified

When i run my code in the test environment to test my new code about kudu insert,it reports to me:
This row was already applied and cannot be modified.
I have already tried to debug my code and to see what is the problem in my code , but it is useless
if((map.get(list.get(i))) instanceof Double){
row.addDouble(list.get(i), (Double) map.get(list.get(i)));
//System.out.println("Double type insert succeed : " + list.get(i) + " : " + map.get(list.get(i)));
continue;
}
I want to know what's wrong in my code because in my previous code i can run correct but know it cannot
In the source code ,The class was that PartialRow has a private propertiy:frozen, It's default value was false,but in my code,when i debug in it,i found that value was true,I think this is the reason that cause the program reports to my : This row was alredy applied and cannot be modified ! asking for help .please
Without full stacktrace and the rest of code I can only guess why this is happening.
My guess is because the Insert object on which this row object is created has already inserted to Kudu (using KuduSession.apply) and then you tried to update it using row.addDouble.
If you are unsure about why please see this example of how to insert into Kudu.
KuduSession.apply method is invoked on Insert object on which PartialRow object is created, this will insert the data from all the PartialRow objects created from the Insert object. This can be done only once on one Insert object. After that you create a new Insert object using KuduTable.newInsert()
In your case you should probably create new object of Insert using KuduTable.newInsert() and create a row object on this.

How to set the value of a field from a different form on it's unload event?

I have two forms(say Form-A and Form-B). On unloading of Form-B, I need to set a value of a field(say Fld-A) present in Form-A. I've tried few approaches but none seem to be working.
1) The most simple way which I tried is this. On the unload event of Form-B, I wrote this code - document.forms["Form-A"]["Fld-A"].value="1". This is not working. The field has the value null.
2) Then I also used #setdocfield on the unload event of Form-B. The formula I used was #setdocfield(#DocumentUniqueId;"Fld-A","1"). Even this doesn't work.
3) Next I used a field on Form-B itself(say Fld-B). On the unload event of Form-B, I wrote the code - document.forms[0].Fld-B.value="1". And then I used this code on the onload event of Form-A - if(document.forms["Form-B"]["Fld-B"].value="1") { document.forms[0].Fld-A.value="1" }. Even this doesn't work.
4) Similarly I also used #getdocfield on Form-A, but still no luck.
Not sure what I'm missing here. Please suggest. Thanks in advance.

BizTalk: Getting error in Promoted Property

I am getting below error when I run the Orchestration and try to assign value to a promoted property by reading the value of another promoted property.
Error in Suspended Orchestration:
Inner exception: There is no value associated with the property BankProcesses.Schemas.Internal_ID' in the message.
Detail:
I have 2 XSD schemas, 1 for calling a stored procedure and reading its response and another to write it into a flat file. The internal ID returned in the response from SP needs to be passed to a node in another XSD schema to write to a flat file format.
I have promoted an element from the response schema and also promoted an element from the schema to write to flat file. I am assigning the value to promoted propeties as below:
strInternalId = msgCallHeaderSP_Response(BankProcesses.Schemas.Internal_ID);
msgCallSP(BankProcesses.Schemas.Header_Internal_ID) = strInternalId;
But when I run the orchestration I get the error as mentioned above. I have checked the reponse from stored procedure and the reponse XML does contain some value but I am unable to assign that value to another schema. Please advice
Thanks,
Mayur
You can use exists to check the existence of property.
if(BankProcesses.Schemas.Internal_ID exists msgCallHeaderSP_Response)
{
strInternalId = msgCallHeaderSP_Response(BankProcesses.Schemas.Internal_ID);
msgCallSP(BankProcesses.Schemas.Header_Internal_ID) = strInternalId;
}
One scenario that might cause this error is that there is no Header_Internal_ID element in the message you are trying to modify. Can you inspect the message before modification to ensure that there is an element whose value should be changed - drop the message out to a file location, maybe.
If this is the case, then just ensure that you create this element when you instantiate you r message for the first time - even if you initially set it to an empty element.
HTH
To check if the property exists, you can use this syntax:
BMWFS.LS.BizTalk.CFS.BankProcesses.Schemas.Internal_ID exists msgCallHeaderSP_Response
However, if the case is that the source field would always be there, you have to work backwards to find out why the Property is not appearing on the Context.
If it's coming from a Port, is the message passign through an XmlDisassembler Component? If it's coming from another Orchestration, are you actually setting the Property?
The easiest way to look at the Context is to route the Message, msgCallHeaderSP_Response, to a Stopped Send Port. You can then view the Context in BizTalk Administrator.

Resources