MessageBox click

Dear all,
How could i get messagebox form and click the OK button in 2004B UI API??
Regards,
Kit

Hello Chun,
try this code:
Option Explicit
Public Sub Main()
    Dim oHelloWorld As HelloWorld
    Set oHelloWorld = New HelloWorld
End Sub
Private WithEvents SBO_Application As SAPbouiCOM.Application
Private Sub SetApplication()
'// Use an SboGuiApi object to establish connection
'// with the SAP Business One application and return an
'// initialized appliction object
    Dim SboGuiApi           As SAPbouiCOM.SboGuiApi
    Dim sConnectionString   As String
    Set SboGuiApi = New SAPbouiCOM.SboGuiApi
    '// by following the steps specified above, the following
    '// statment should be suficient for either development or run mode
    sConnectionString = Command
    '// connect to a running SBO Application
    SboGuiApi.Connect sConnectionString
    '// get an initialized application object
    Set SBO_Application = SboGuiApi.GetApplication()
End Sub
Private Sub Class_Initialize()
'// set SBO_Application with an initialized application object
    SetApplication
'// send an "hello world" message
    SBO_Application.MessageBox ("Hello World")
End Sub
This will display a Hello World messagebox in SAP.  Make sure that the SAPB1 is opened.  Hope this helps...

Similar Messages

  • Error can't Click button when add value to ComboBox

    How can I do ? who know programming C#  ? help me !
    ComboBox displayed value but I can't Click " Exit Button " (btnExit) and Click "Cal button"(btnCal)
    IF I Remove   this  code
    if ((pVal.ItemUID == "CbIncen") && (pVal.Before_Action == true))// && (pVal.EventType == SAPbouiCOM.BoEventTypes.et_GOT_FOCUS))
    or
    remove  * oComBox.ValidValues.Add(value2, value1);  *
    " then OK no error and I can  Click Exit Button and Click Cal button
    private void SBO_Application_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent)
                BubbleEvent = true;
                 if((pVal.FormUID=="CalculateForm"))
                  if ((pVal.ItemUID == "btnCal") && (pVal.Before_Action == false) && (pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED))
                       // return  value when click  "btnCal" button
                      SBO_Application.MessageBox("You click button", 1, "OK", "", "");
                   if ((pVal.ItemUID == "btnExit") && (pVal.Before_Action == false) && (pVal.EventType == SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED))
                       // return  value when click  "btnCal" button
                      SBO_Application.MessageBox("You click Exit", 1, "OK", "", "");
                      oForm = SBO_Application.Forms.Item(pVal.FormUID);
                      oForm.Close();          
                    if ((pVal.ItemUID == "CbIncen") && (pVal.Before_Action == true))// && (pVal.EventType == SAPbouiCOM.BoEventTypes.et_GOT_FOCUS))
                        SBO_Application.MessageBox("click" + Convert.ToString(pVal.Before_Action), 1, "OK", "", "");
                       // BubbleEvent = true;
                        SAPbouiCOM.Form oForm1;
                        SAPbouiCOM.Item oItem1;
                        SAPbouiCOM.ComboBox oComBox;
                        SAPbobsCOM.Recordset oRecordSet;
                        oForm1 = SBO_Application.Forms.Item(pVal.FormUID);
                        ////tra lai gia tri tu combo va dua vao textbox
                        oItem1 = oForm1.Items.Item("CbIncen");
                        oComBox = ((SAPbouiCOM.ComboBox)(oItem1.Specific));
                        //cai nay co nhuoc diem la ban ko the update lien tuc
                        oRecordSet = ((SAPbobsCOM.Recordset)(oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)));
                        string sSQL = "select IncentiveID,IncentiveName from dbo.[T_Incentive]";
                        while (oComBox.ValidValues.Count > 0)
                            oComBox.ValidValues.Remove(0, SAPbouiCOM.BoSearchKey.psk_Index);
                        oForm1.Items.Item("CbIncen").Refresh();
                        //truong khi add vao comboBox ban phai remove combox
                        oRecordSet.DoQuery(sSQL);
                        string value1 ="";
                        string value2 ="";
                        if (oRecordSet.RecordCount > 0)
                            while (!(oRecordSet.EoF == true))
                                value1 = Convert.ToString(oRecordSet.Fields.Item("IncentiveID").Value);
                                value2 = Convert.ToString(oRecordSet.Fields.Item("IncentiveName").Value);
                                oComBox.ValidValues.Add(value2, value1);  // *ComboBox displayed value but I can't Click " Exit Button " (btnExit) and Click "Cal button"(btnCal)*
                                oRecordSet.MoveNext();
                        //BubbleEvent = true;
    thanks you !

    Hi fithou,
    Please post half of your text on a reply under the same post. And put your code between  tags.
    Regards,
    Vítor Vieira

  • UI API emulate click on MessageBox

    Dear expert,
      When the end user change the quantity field in order recommedation report(MRP).  The message box is shown. Now, i want to use use UI API to emulate the click action and answer this message box.  How could i do that??  I tried and checked the doc, the user data source can only use in user added matrix. So in this case ,i cannot use user data source.
    Regards,
    Kit

    Dear lbai,
      Could u give me more example?? i have implemented the following code. But, it makes the UI server down.
    ElseIf pVal.FormType = 0 Then
    Try
         Debug.WriteLine("Form UID: " & FormUID)
      If SBO_Application.Forms.ActiveForm.Type = 65217 _
          And Not pVal.BeforeAction Then
         Dim box As SAPbouiCOM.Form
         box = SBO_Application.Forms.Item(FormUID)
          If Not box Is Nothing Then
             Debug.WriteLine("Got Box")
          Else
             Debug.WriteLine("Fail To Get")
          End If
       Debug.WriteLine("Box Item Count: " & box.Items.Count)
       ' Click default button  
       box.Items.Item("1").Click()
    End If
       Catch ex As Exception
            Debug.WriteLine(ex.Message)
        End Try
    End If

  • How to cancelling email submission after user clicks "yes/no" button of message box?

    could some one tell me, how can i cancelling the submission event after one user clicks "yes/no" button of message box? The scenario is the following:
    After data input in a dynamic form clicks the user send mail button. Before the email submit, the user has to decide going back to the form and validate the input or continuing to submit email.
    In case of going back to validate input the submission event must not solve. So, how can i implemente it in java and/or form calc script?
    Thanks so much for your help in advance and i am very glad to hearing from you soon!
    Djinges

    Hello,
    The most easy way to solve your problem is to add two buttons, the first should be regular button and the second is submit by e-mail one. Set the
    'presence' property of the second to 'hidden' and add to it your email address. To the first button on 'click' event add the script like this
    form1.#subform[0].Button1::click - (JavaScript, client)
    var answer = xfa.host.messageBox("Send e-mail?","e-mail",2,1);
    if(answer==1){
    EmailSubmitButton1.execEvent('click');
    Hope this helps.

  • How can we use Custom MessageBox in SelectionChangedEvent of LongListSelector for Windows Phone 8

    Dear Sir/Madam,
    How can we use Custom MessageBox in SelectionChangedEvent of LongListSelector for Windows Phone 8.
    Actually my problem is that When i am using Custom  MessageBox in SelectionChangedEvent of LongListSelector,when i am click Open(Left Button) it's working fine and navigated correctly,But when i am Click the No(Right Button) then it stayed in same page
    but all that page is in stuckup i mean that page is not working and not doing any event.
    My C#.net Code
    private async void userPageLongListSelector_SelectionChanged(object sender, SelectionChangedEventArgs e)
    if (e.AddedItems.Count > 0)
    if (userPageLongListSelector.SelectedItem == null)
    return;
    if (dbTenMin == null)
    dbTenMin = new Database(ApplicationData.Current.LocalFolder, "tenMInDBSchema.db");
    await dbTenMin.OpenAsync();
    var res = (sender as LongListSelector).SelectedItem as _10Min._10MinClass.minUserPages;
    var resIndex = (sender as LongListSelector).ItemsSource.IndexOf(userPageLongListSelector.SelectedItem);
    string selectedPageName = res.userPages.ToString();
    string selectedPageDesignUser = res.pageDesignUser.ToString();
    int selectedIndex = resIndex;
    CustomMessageBox messageBox = new CustomMessageBox()
    Caption = "Message...!",
    Message = "This form need offline datalist,Please load now.",
    LeftButtonContent = "Open",
    RightButtonContent = "No"
    messageBox.Dismissed += (s1, e1) =>
    switch (e1.Result)
    case CustomMessageBoxResult.LeftButton:
    string uidAndpwd = _10MinClass._10MinStaticClass.csUidAndPwd.ToString();
    _10MinClass._10MinStaticClass.csDataListPageDetails = selectedPageDataDetailsForSchema.ToString();
    _10MinClass._10MinStaticClass.csAllDataLists = offlineDataBaseDataListNam;
    _10MinClass._10MinStaticClass.csNotCreatedSchemaNameOfDBList = notCreatedDataLists;
    userPageLongListSelector.SelectedItem = null;
    if (dbTenMin != null)
    dbTenMin.Dispose();
    dbTenMin = null;
    NavigationService.Navigate(new Uri("/10MinformDataList.xaml", UriKind.Relative));
    else
    NavigationService.Navigate(new Uri("/10MinformDataList.xaml", UriKind.Relative));
    break;
    case CustomMessageBoxResult.RightButton:
    break;
    case CustomMessageBoxResult.None:
    break;
    default:
    break;
    messageBox.Show();
    Same custom messagebox code working in Phone_BackKeyPress event i am writing the code in Right Button that e.OriginalSource.ToString(); then it is working fine.
    But It is not working in Selection Changed Event in LongListSelector control in Windows Phone 8.
    Please help me,as soon as possible.
    Thanks & Regards,
    SrinivaaS.

    What happens if you leave the implementation for LeftButton empty as well , does the page gets stuck in that case also, if you press left button?
    i.e.
    CustomMessageBox messageBox = new CustomMessageBox()
    Caption = "Message...!",
    Message = "This form need offline datalist,Please load now.",
    LeftButtonContent = "Open",
    RightButtonContent = "No"
    messageBox.Dismissed += (s1, e1) =>
    switch (e1.Result)
    case CustomMessageBoxResult.LeftButton:
    break;
    case CustomMessageBoxResult.RightButton:
    break;
    case CustomMessageBoxResult.None:
    break;
    default:
    break;
    messageBox.Show();
    http://developer.nokia.com/community/wiki/Using_Crypto%2B%2B_library_with_Windows_Phone_8

  • Add Subform dynamically,on click of Button, in Interactive form generated by Adobe Document Services

    HI,
    I have an XDP file designed by Adobe Designer 7.1 with the following hierarchy of elements:
    -form1(root)
    --Button
    --tmpForm (subform - Repeat subform for each data entry )
    ---ST (Text)
    Now, this XDP file generates an Interactive PDF form with Reader Rights enabled by the Adobe Document Services.
    On click of button, the following javascript is executed on client side:
    var df = _tmpForm.addInstance(1);
    df.ST.rawValue = "HI" ;
    xfa.host.messageBox( "Instances" + tmpForm.all.length ) ;
    On clicking the button, i get the length of the instances of the subform and the size increases on each click, but no element is added "visibly" to the pdf.
    But when i try to do the same by saving the XDP file as Dynamic PDF form for Acrobat 8.0,and open it using Adobe Acrobat PRO 8.0, it works fine.
    My question is,I s it not possible to add subforms dynamically in PDF's generated by Adobe Document Services with Reader Rights enabled?
    Or, is there something that i am missing?
    Please guide.
    Thanks.
    Regards,
    Siddhartha

    Hi,
    you can't change the behavior of the save button in the browser nor in Reader/Acrobat.
    You can add a custom button within your form which calls a custom script from a folder level script using the browserForDoc method.
    The browseForDoc methos is the only one whcih can change the name in the saveAs dialog.
    Here's an example., you can run from Acrobat console.
    You need to combine it with the solution from the other thread to make it work with your form.
    http://forums.adobe.com/message/2266799#2266799%232266799
    var oRetn = app.browseForDoc({
        bSave: true,
        cFilenameInit: "MyForm.pdf",
        cFSInit: "",
    if (typeof oRetn !== "undefined") {
        this.saveAs({
            cFS: oRetn.cFS,
            cPath: oRetn.cPath,
            bPromptToOverwrite: false

  • How to change appearance of xfa.host.messagebox

        Is there anyway to apply a different look to the xfa.host.messagebox ?  It is pretty, um what is the word ..... -- ugly. That is the word
    Any help would be very appreciated.
    Thanks

    Hi,
    The url that Steve gave above takes you to the Help file for LC Designer.
    You put the messageBox line within your script when you want to alert the user to something or to give them a choice. for example you could put the script within a calculate event to let the user know the value of a hidden variable:
    xfa.host.messageBox("This is a message", "This is a title", 3, 1);
    The help file sets out the four different options for the last two parameters (which can be used in any combination).
    xfa.host.messageBox("This messageBox uses:\n\nParameter 3 = 1 (Warning) and Parameter 4 = 1 (OK, Cancel)", "Hello World!", 1, 1);
    The "\n" will insert a return (new line).
    Scripting for additional features within a dialogue window can be achieved using the Javascript Dialog Object; however this is getting quite advanced. The AcroDialog product from Windjack Solutions does make this process easier.
    The messageBox returns a number depending on which button the user clicks:
    Returns 1 if the user clicks OK;
    Returns 2 if the user clicks Cancel;
    Returns 3 if the user clicks No;
    Returns 4 if the user clicks Yes;
    On this basis you can script actions depending on which button the user clicks in your messageBox, by asigning the returning value to a variable and then looking at the value of the variable. For example in the click event of a button on the form:
    var nButton = xfa.host.messageBox("You are about to delete this row.\n\nDo you want to continue?", "DELETE ROW", 3, 2);
    if (nButton == 4) // Hitting the Yes button returns 4
         _dyndetail.removeInstance(this.parent.index); // proceed with delete
    The above deals with LiveCycle Designer. If you are scripting exclusively in Acrobat then you could use the app.alert(); method, to display your message.
    Hope this helps,
    Niall

  • UI API issue, clicking base document on sales order does not set ActiveForm

    I have a sales order window open with a sales order loaded.  When I right click and click on base document, the sales quotation window shows up properly, however in code when I get the ActiveForm, it is the sales order form and not the sales quotation form!
    Private Sub SBO_Application_FormDataEvent(ByRef BusinessObjectInfo As SAPbouiCOM.BusinessObjectInfo, ByRef BubbleEvent As Boolean) Handles SBO_Application.FormDataEvent
        If BusinessObjectInfo.Type = bo_type.SALES_QUOTATION And BusinessObjectInfo.BeforeAction = False And    BusinessObjectInfo.EventType = BoEventTypes.et_FORM_DATA_LOAD
            SBO_Application.MessageBox(SBO_Application.Forms.ActiveForm.Type) 'shows 139 instead of 149?
        End If
    End Sub
    If quotation data is loaded using the next/prev/first/last buttons on the menu bar, the activeform .Type is 149.
    If quotation data is laoded using the Base Document shortcut on the sales order, the activeform.Type is 139.
    Is that suppose to be correct?  If so, how do I get the new sales quotation form that is created by using the base document shortcut?
    Edited by: Dung Nguyen on Aug 24, 2011 2:12 AM

    János Nagy wrote:
    Hi Dung,
    >
    > Formdataevent is handling trhe data events, not GUI events. In form data load means that the form is data is loaded, not that the form is activated.
    >
    > You must handle menuevent, and in menuevent before_action = false case the active form will be the sales quotation (or child/parent in the document flow).
    >
    > You may use an SDN tool to determine the events. You can download it from:
    > http://www.sdn.sap.com/irj/scn/businessone-tools
    >
    >
    > Regards
    >
    > János
    The problem with form activated is that it is triggered everytime the window is "activated'.  Meaning that if a user clicks out of the form and clicks back in, the form activated event is triggered.
    I need to perform an operation only on the first time the form and data is loaded and/or activated.

  • Can't get click event to load from ImageButton

    *Newbie Alert*
    I am trying to create dynamic image buttons that when clicked will redirect to anothr page as well as add a new item to a SharePoint list. My Image buttons create sucessfully but the click event is not loaded. I have added a break point visual studio and
    can see that the function is never loaded.
    My Image button creation code (within Page_load) is:
    ImageButton lnk = new ImageButton();
    lnk.ID = WPtitle;
    lnk.CommandName = WPtitle;
    lnk.CommandArgument = WPtitle;
    lnk.PostBackUrl = WPUrl;
    lnk.Visible = true;
    lnk.ImageUrl = WPImgUrl;
    tc.Controls.Add(lnk);
    lnk.Click += new System.Web.UI.ImageClickEventHandler(this.send_Click);
    and then my event is:
    public void send_Click(object sender, ImageClickEventArgs e)
    SPWeb site = SPContext.Current.Web;
    var clicklist = site.Lists["listname"];
    string WPTitle = ((ImageButton)sender).CommandArgument.ToString();
    SPListItem additem = clicklist.AddItem();
    additem["Title"] = "text";
    additem["Clicked"] = "1";
    additem.Update();
    Any help as to why this is not loading would be greatly appreciated.
    Thanks

    hi,
    you have assign a evenhandler after you add the button to the control list. just assign your event handler before you add the button to the control list.
    2nd option is
    bn.Click += MyClick;
    private void MyClick(object sender, EventArgs e) {
    MessageBox.Show("hello");
    Here you're registering a click event and specify the code that runs when the event fires.
    http://stackoverflow.com/questions/8207449/how-to-dynamically-add-a-code-behind-for-button
    if this helps you please mark as the answer.

  • Wpf open PDF file in Adobe Reader with a click on a button

    I need a button to open a PDF file with Adobe Reader. I have the following code but it does not work. The file is inside Books folder
    on my application.
    private void openPDF(object sender, RoutedEventArgs e)
    try
    System.Diagnostics.Process process = new System.Diagnostics.Process();
    bookPDF = "Books/" + dataRow.ItemArray[6].ToString();
    Uri pdf = new Uri(bookPDF, UriKind.Relative);
    process.StartInfo.FileName = pdf.LocalPath;
    process.Start();
    process.WaitForExit();
    catch(Exception error)
    MessageBox.Show("Could not open the file.", "Error", MessageBoxButton.OK, MessageBoxImage.Warning);
    I tested a simple string with a test pdf file to open and it opens.
    String file = "C:\pdf\Windows_Server_2008_R2_Unleashed.pdf";
    process.StartInfo.FileName = file;
    process.Start(); process.WaitForExit();

    Hi Carlos Sota,
    In my experience, I suggest that you could set Copy to Output Directory property of the PDF file to “Copy always”.
    Below are my code snippet and screenshot.
    private void Button_Click(object sender, RoutedEventArgs e)
    try
    System.Diagnostics.Process process = new System.Diagnostics.Process();
    string path = AppDomain.CurrentDomain.BaseDirectory+@"/abc.pdf";
    Uri pdf = new Uri(path, UriKind.RelativeOrAbsolute);
    process.StartInfo.FileName = pdf.LocalPath;
    process.Start();
    process.WaitForExit();
    catch (Exception error)
    MessageBox.Show("Could not open the file.", "Error", MessageBoxButton.OK, MessageBoxImage.Warning);
    Best Regards,
    Xavier Eoro
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Error Message "iPod can not be updated.." but works after clicking away msg

    Hi!
    I have installed an German iTunes 6.0.4.2. and the newes IPod Software under WinXP.
    After clicking " iPod Aktualisieren" I get the following message:
    Der iPod "xxx" kann nicht aktualisiert werden. Ein unbekannter Fehler ist aufgetreten (-39).
    Transl:
    The iPod "xxx" cannot be updated. An unknwon Error has occured (-39).
    After clicking away the messagebox everything sync's fine.
    Whats wrong here? I have the problem for a week or so and already updated iTunes and the iPod software so far. And reset the iPod back to delivery conditions with the update tool. Nothing worked.
    kind regards
    marcus

    I did a search on Google for Error -39, and it suggests 2 things. Installing the latest version (which is sounds like you have) and turning OFF web accelerators if there are any running...
    http://docs.info.apple.com/article.html?artnum=44000

  • Function call from button works then vanishes if I click anywhere

    I have the following code and it works great some times but others nothing happens, the button seems to work then for no apparent reason (at least nothing that comes up in the javascript console) I click and it says "FundName.FundTitle.getFundTitle is not a function" but it worked several times before that and nothing changed. Feel like I'm losing my mind, please give me some insight if you have any, everything is set to export for acrobat 9 and I have reader nine installed.
    DeedEstablishmentForm.Page1.Button2::click - (JavaScript, client)
    var str = FundName.FundTitle.getFundTitle();
    I have a fragment that has the following:
    form1.FundName.FundTitle::initialize - (JavaScript, client)
    function getFundTitle(){
    this.str = new String(this.rawValue);
    this.start = str.length - 20;
    this.idx = str.toLowerCase().lastIndexOf('superannuation fund');
    xfa.host.messageBox(this.str.valueOf());
    xfa.host.messageBox(this.start.toString());
    xfa.host.messageBox(this.idx.toString());
    if(this.start >= 1 && this.idx >= this.start && this.idx >= 1){
    return this.str.slice(0,idx);
    }else{
    return this.str;

    I talked to the developers about this one and I think we figured out what is happening. It has to do with the scope of the function. Here is what we believe is happening. You have defined your function on the Initialize event of an object. The function gets created and at the end of the Initialize event script it is no longer needed so it is marked for deletion. The function is still around until the next garbage collection cycle. Now the form finishes loading and you hit the button to call the function. Because th efunction still exists it is called. You continue to do this and all is OK. At some point garbage collection will run and the function will be deleted. It is at that point that you call it again and get the error. To resolve this problem you need to ensure that the funstion is always available. If you move your function to a script object then when the form loads the script object will run and your function will be created. Now it is callable at all times and shoudl alleviate th eissue you are having.
    On another note I noticed the use of the "this" key word in your script. In our world the "this" object is the obejct that has focus (or who is making the call). The ability to extend the "this" object as you do with str, start and idx is going to disappear. The "this" object will become immutable in a future release. To ensure that you do not have issues in a future release I suggest you change the way you do that code.
    Lastly by moving the code to a script object you will not be able to use "this". You can pass an object to the script and use that instead.
    Hope that helps. Let me know if you need further explanation.
    Paul

  • Excel Macro to click on publish button of Master Data Services Add-in

    I am creating an excel macro to perform extra validation and defaults whilst the user is editing the MDS entity. It will be added as a workbook add-in. At the end of the macro I would like to be able to launch publish. The MDS addin is a ribbon.
    Does anyone have an example of how I can simulate a click on the Publish button or what the call that the button does is?
    David Roseneder

    Hi David
    here is a code sample to add mds actions with excel Buttons
    you can find the connection class separately, by downloading my sample project (C#) on codeplex :
    http://mdsmanager.codeplex.com
    (I use this MDS connection class for many projects)
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Xml.Linq;
    using Microsoft.VisualStudio.Tools.Applications.Runtime;
    using Excel = Microsoft.Office.Interop.Excel;
    using Office = Microsoft.Office.Core;
    using System.Xml;
    using System.Collections.ObjectModel;
    using Common.ServiceReference1;
    namespace ExcelToMDS
    public partial class Sheet1
    public const string mdsEndPoint = "http://yourMDSEndpointUrl:4040/Service/Service.svc";
    ServiceClient c = null;
    International intl = new International();
    OperationResult or = new OperationResult();
    Metadata md = null;
    private void Sheet1_Startup(object sender, System.EventArgs e)
    using (var c = Common.MDS_WSConnect.CreateMdsProxy("yourdomain", "yourlogin", "yourpassword", mdsEndPoint))
    c.Open();
    International intl = new International();
    OperationResult or = new OperationResult();
    md = GetMetaData(intl, ref or);
    cbModels.Items.Clear();
    foreach (Model mo in md.Models)
    cbModels.Items.Add(mo.Identifier);
    cbModels.DisplayMember = "Name";
    cbEntities.Visible = true;
    private Metadata GetMetaData(International intl, ref OperationResult or)
    MetadataResultOptions mro = new MetadataResultOptions();
    MetadataSearchCriteria msc = new MetadataSearchCriteria();
    msc.Models = new Collection<Identifier>() { new Identifier() };
    msc.Versions = new Collection<Identifier>() { new Identifier() };
    msc.SearchOption = SearchOption.UserDefinedObjectsOnly;
    mro.Models = ResultType.Identifiers;
    mro.Versions = ResultType.Identifiers;
    cbModels.Items.Clear();
    Metadata md = c.MetadataGet(intl, mro, msc, out or);
    return md;
    private void Sheet1_Shutdown(object sender, System.EventArgs e)
    if (c != null && c.State != System.ServiceModel.CommunicationState.Closed)
    c.Close();
    #region VSTO Designer generated code
    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InternalStartup()
    this.btGetMDSData.Click += new System.EventHandler(this.btGetMDSData_Click);
    this.btGetTransactions.Click += new System.EventHandler(this.btGetTransactions_Click);
    this.btUpdateAttribute.Click += new System.EventHandler(this.btUpdateAttribute_Click);
    this.cbModels.SelectedIndexChanged += new System.EventHandler(this.cbModels_SelectedIndexChanged);
    this.cbMembers.SelectedIndexChanged += new System.EventHandler(this.cbMembers_SelectedIndexChanged);
    this.cbEntities.SelectedIndexChanged += new System.EventHandler(this.cbEntities_SelectedIndexChanged);
    this.cbVersions.SelectedIndexChanged += new System.EventHandler(this.cbVersions_SelectedIndexChanged);
    this.cbAttributes.SelectedIndexChanged += new System.EventHandler(this.cbAttributes_SelectedIndexChanged);
    this.btReverseTran.Click += new System.EventHandler(this.btReverseTran_Click);
    this.Shutdown += new System.EventHandler(this.Sheet1_Shutdown);
    this.Startup += new System.EventHandler(this.Sheet1_Startup);
    #endregion
    private void btGetMDSData_Click(object sender, EventArgs e)
    Cursor.Current = Cursors.WaitCursor;
    DisplayEntityMembers(c);
    Cursor.Current = Cursors.Default;
    private void DisplayEntityMembers(ServiceClient c)
    EntityMembers em = GetEntityMembers(c);
    if (em != null)
    Member[] members = em.Members.ToArray();
    ((Excel.Range)this.Cells[2, 2]).Value2 = "MemberName";
    ((Excel.Range)this.Cells[2, 3]).Value2 = "AttributeName";
    ((Excel.Range)this.Cells[2, 4]).Value2 = "AttributeValue";
    for (int i = 0; i < members.Length; i++)
    ((Excel.Range)this.Cells[i + 3, 2]).Value2 = members[i].MemberId.Name;
    int cptAtt = 0;
    foreach (Common.ServiceReference1.Attribute att in members[i].Attributes)
    ((Excel.Range)this.Cells[i + 3, cptAtt + 3]).Value2 = att.Identifier.Name.ToString();
    ((Excel.Range)this.Cells[i + 3, cptAtt + 4]).Value2 = att.Value != null ? att.Value.ToString() : "";
    cptAtt += members[i].Attributes.Count();
    private EntityMembers GetEntityMembers(ServiceClient c)
    if (cbModels.SelectedItem != null && cbEntities.SelectedItem != null && cbVersions.SelectedItem != null)
    EntityMembersGetCriteria emGetCrit = new EntityMembersGetCriteria();
    emGetCrit.ModelId = new Identifier() { Name = ((Identifier)cbModels.SelectedItem).Name };
    emGetCrit.EntityId = new Identifier() { Name = ((Identifier)cbEntities.SelectedItem).Name };
    emGetCrit.VersionId = new Identifier() { Name = ((Identifier)cbVersions.SelectedItem).Name };
    //ExportView[] ev = c.ExportViewListGet(new International(), out or);
    EntityMembersInformation emi = new EntityMembersInformation();
    emGetCrit.DisplayType = DisplayType.CodeName;
    EntityMembers em = c.EntityMembersGet(intl, emGetCrit, out emi, out or);
    return em;
    else
    MessageBox.Show("Please select model, version and entity in comboboxes");
    return null;
    private void btGetTransactions_Click(object sender, EventArgs e)
    if (cbModels.SelectedItem != null)
    this.Rows.Clear();
    using (var c = Common.MDS_WSConnect.CreateMdsProxy("yourdomain", "yourlogin", "yourpassword", mdsEndPoint))
    c.Open();
    DisplayTransactions(c);
    c.Close();
    else
    MessageBox.Show("Please select Model in combos");
    private void DisplayTransactions(ServiceClient c)
    string versionName = "VERSION_1";
    if (cbVersions.SelectedItem != null)
    versionName = ((Identifier)cbVersions.SelectedItem).Name;
    TransactionSearchCriteria trSrchCrit = new TransactionSearchCriteria();
    trSrchCrit.ModelId = new Identifier() { Name = ((Identifier)cbModels.SelectedItem).Name };
    //trSrchCrit.EntityId = new Identifier() { Name = ((Identifier)cbEntities.SelectedItem).Name };
    trSrchCrit.EntityId = new Identifier();
    trSrchCrit.VersionId = new Identifier() { Name = versionName };
    //ExportView[] ev = c.ExportViewListGet(new International(), out or);
    EntityMembersInformation emi = new EntityMembersInformation();
    int totalTranCount = 0;
    Collection<Transaction> transactions = new Collection<Transaction>();
    OperationResult or = c.TransactionsGet(intl, trSrchCrit, out totalTranCount, out transactions);
    int startY = 4;
    int startDataY = startY + 1;
    int startX = 4;
    ((Excel.Range)this.Cells[startY, startX]).Value2 = "TransactionID";
    ((Excel.Range)this.Cells[startY, startX + 1]).Value2 = "Code";
    ((Excel.Range)this.Cells[startY, startX + 2]).Value2 = "Name";
    ((Excel.Range)this.Cells[startY, startX + 3]).Value2 = "MemberType";
    ((Excel.Range)this.Cells[startY, startX + 4]).Value2 = "Date";
    ((Excel.Range)this.Cells[startY, startX + 5]).Value2 = "AttributeName";
    ((Excel.Range)this.Cells[startY, startX + 6]).Value2 = "PriorValue";
    ((Excel.Range)this.Cells[startY, startX + 7]).Value2 = "NewValue";
    for (int i = 0; i < transactions.Count(); i++)
    ((Excel.Range)this.Cells[i + startDataY, startX]).Value2 = transactions[i].Id.ToString();
    ((Excel.Range)this.Cells[i + startDataY, startX + 1]).Value2 = transactions[i].MemberId.Code;
    ((Excel.Range)this.Cells[i + startDataY, startX + 2]).Value2 = transactions[i].MemberId.Name;
    ((Excel.Range)this.Cells[i + startDataY, startX + 3]).Value2 = transactions[i].MemberId.MemberType.ToString();
    ((Excel.Range)this.Cells[i + startDataY, startX + 4]).Value2 = transactions[i].Date.ToString();
    ((Excel.Range)this.Cells[i + startDataY, startX + 5]).Value2 = transactions[i].AttributeId.Name;
    ((Excel.Range)this.Cells[i + startDataY, startX + 6]).Value2 = transactions[i].PriorValue;
    ((Excel.Range)this.Cells[i + startDataY, startX + 7]).Value2 = transactions[i].NewValue;
    private void btUpdateAttribute_Click(object sender, EventArgs e)
    Cursor.Current = Cursors.WaitCursor;
    using (var c = Common.MDS_WSConnect.CreateMdsProxy("yourdomain", "yourlogin", "yourpassword", mdsEndPoint))
    c.Open();
    EntityMembers em = GetEntityMembers(c);
    Member[] members = em.Members.ToArray();
    for (int i = 0; i < members.Length; i++)
    ((Excel.Range)this.Cells[i + 3, 2]).Value2 = members[i].MemberId.Name;
    foreach (Common.ServiceReference1.Attribute att in members[i].Attributes)
    if (att.Identifier.Name == "ValidDandT")
    att.Value = DateTime.Now;
    c.EntityMembersUpdate(intl, em);
    DisplayEntityMembers(c);
    c.Close();
    Cursor.Current = Cursors.Default;
    private void cbModels_SelectedIndexChanged(object sender, EventArgs e)
    Identifier i = (Identifier)cbModels.SelectedItem;
    if (md != null)
    cbVersions.Items.Clear();
    foreach (Common.ServiceReference1.Version v in md.Versions)
    if (v.Identifier.ModelId.Id == i.Id)
    cbVersions.Items.Add(v.Identifier);
    cbVersions.DisplayMember = "Name";
    private void cbVersions_SelectedIndexChanged(object sender, EventArgs e)
    Identifier iVer = (Identifier)cbVersions.SelectedItem;
    ModelMembersGetCriteria mmgc = new ModelMembersGetCriteria();
    mmgc.Models = new Collection<Identifier>() { new Identifier() { Name = ((Identifier)cbModels.SelectedItem).Name } };
    ModelMembersResultCriteria mmrc = new ModelMembersResultCriteria();
    mmgc.Versions = new Collection<Identifier>() { new Identifier() { Id = iVer.Id } };
    mmrc.IncludeLeafMembers = true;
    cbEntities.Items.Clear();
    cbMembers.Items.Clear();
    Collection<EntityMembers> colEm = c.ModelMembersGet(intl, mmgc, mmrc, out or);
    foreach (EntityMembers em in colEm)
    cbEntities.Items.Add(em.EntityId);
    cbEntities.DisplayMember = "Name";
    private void cbEntities_SelectedIndexChanged(object sender, EventArgs e)
    DisplayEntityAttributesCombo(c);
    DisplayEntityAttributesAndMembersInSheet();
    private void DisplayEntityAttributesAndMembersInSheet()
    EntityMembers em = GetEntityMembers(c);
    Member[] members = em.Members.ToArray();
    ((Excel.Range)this.Cells[2, 2]).Value2 = "MemberName";
    ((Excel.Range)this.Cells[2, 3]).Value2 = "AttributeName";
    ((Excel.Range)this.Cells[2, 4]).Value2 = "AttributeValue";
    if (members.Count() > 0)
    int ii = 0;
    //attributes name on header line
    foreach (Common.ServiceReference1.Attribute att in members[0].Attributes)
    ((Excel.Range)this.Cells[3, ii + 3]).Value2 = att.Identifier.Name.ToString();
    ii++;
    //members Data
    int cptnbAttributes = members[0].Attributes.Count();
    for (int i = 0; i < members.Length; i++)
    for (int j = 0; j < cptnbAttributes - 1; j++)
    ((Excel.Range)this.Cells[i + 4, j + 3]).Value2 = members[i].MemberId.MemberType;
    private void DisplayEntityAttributesCombo(ServiceClient c)
    EntityMembers em = GetEntityMembers(c);
    Member[] members = em.Members.ToArray();
    if (members.Count() > 0)
    cbAttributes.Items.Clear();
    foreach (Common.ServiceReference1.Attribute a in members[0].Attributes)
    cbAttributes.Items.Add(a.Identifier);
    cbAttributes.DisplayMember = "Name";
    cbAttributes.Visible = true;
    private void cbMembers_SelectedIndexChanged(object sender, EventArgs e)
    Identifier idMember = (Identifier)cbMembers.SelectedItem;
    EntityMembers em = GetEntityMembers(c);
    Member[] members = em.Members.ToArray();
    Member m = members.FirstOrDefault(p => p.MemberId.Id == idMember.Id);
    cbAttributes.Items.Clear();
    foreach (Common.ServiceReference1.Attribute att in m.Attributes)
    cbAttributes.Items.Add(att.Identifier);
    cbAttributes.DisplayMember = "Name";
    cbAttributes.Visible = true;
    private void cbAttributes_SelectedIndexChanged(object sender, EventArgs e)
    private void btReverseTran_Click(object sender, EventArgs e)
    using (var c = Common.MDS_WSConnect.CreateMdsProxy("yourdomain", "yourlogin", "yourpassword", mdsEndPoint))
    c.Open();
    UpdateTransaction(c);
    DisplayTransactions(c);
    c.Close();
    private void UpdateTransaction(ServiceClient c)
    string versionName = "VERSION_1";
    if (cbVersions.SelectedItem != null)
    versionName = ((Identifier)cbVersions.SelectedItem).Name;
    TransactionSearchCriteria trSrchCrit = new TransactionSearchCriteria();
    trSrchCrit.ModelId = new Identifier() { Name = ((Identifier)cbModels.SelectedItem).Name };
    //trSrchCrit.EntityId = new Identifier() { Name = ((Identifier)cbEntities.SelectedItem).Name };
    trSrchCrit.EntityId = new Identifier();
    trSrchCrit.VersionId = new Identifier() { Name = versionName };
    //ExportView[] ev = c.ExportViewListGet(new International(), out or);
    EntityMembersInformation emi = new EntityMembersInformation();
    int totalTranCount = 0;
    Collection<Transaction> transactions = new Collection<Transaction>();
    OperationResult or = c.TransactionsGet(intl, trSrchCrit, out totalTranCount, out transactions);
    Collection<ReplacementId> transactionReversed = new Collection<ReplacementId>();
    or = c.TransactionsReverse(intl, new Collection<int>() { transactions.First().Id }, out transactionReversed);
    Xavier Averbouch
    Microsoft Community Contributor
    Avanade , FRANCE
    If a post answers your question, please click "Mark As Answer" on that post and "Vote as Helpful".

  • No KeyDown detected on a new Window presented with ShowDialog (a mouse click is required before working)

    Hello,
    I shorter the code.
    In MainWindow I have a button to open a SecondWindow 
    private void ButtonNextWindow_Click(object sender, RoutedEventArgs e)
                WindowState = WindowState.Minimized;
                var secondWindow = new SecondWindow();
                secondWindow.ShowDialog();
                WindowState = WindowState.Normal;
    In the second window class I declared a KeyDown event called onKeyDown
    private void onKeyDown(object sender, KeyEventArgs e)
                MessageBox.Show("Key Pressed");
    well... it works only if I first click in the Second Window with the mouse, wherever I want.
    I would avoid this click; seems something related with the Keyboard focus.
    Thanks in advance,
    Vincenzo

    Set second window to focus after you set first window state to normal
    private void ButtonNextWindow_Click(object sender, RoutedEventArgs e)
                WindowState = WindowState.Minimized;
                var secondWindow = new SecondWindow();
                secondWindow.ShowDialog();
                WindowState = WindowState.Normal;
    secondWindow.Focus();

  • Using messageBox in locking fields

    I've got a form that's functioning somewhat like an index. When data is filled in for a particular entry, it needs to be locked down. My strategy for accomplishing this is using a button with scripting to set the access on those particular fields to ReadOnly.
    This all works great -until I try to add in a variable of a messageBox in which the user gets a warning and is allowed to back-out of the lockdown to make changes as needed. It seems that using hte messageBox is an all or nothing proposition -I can't figure out how to access the "okay" or "cancel" buttons to create behavior from there. Everything I try either locks the fields or does not allow the locking regardless of the button pressed.
    Can anybody point me in the right direction here?
    Thanks!
    Jennifer

    Take a look at page 594 of the XML Forms Object Model Reference. You'll see what the return values for xfa.host.messageBox() are, and that they are based on what button is clicked by the user. Hope that helps.
    Chris
    Adobe Enterprise Developer Support

Maybe you are looking for

  • Changed resolution by mistake and have lost everything "mode not supported"

    Guys, This one is totally my own fault but ive managed to crash my Apple TV and was wondering if someone may be able to assit me with a solution? Apple TV was working fine on my samsung HD TV and i was playing about with the settings. I belive i was

  • Calling JavaScript from a swf in wordpress

    Just started using wordpress for my site after years of standard HTML and hit a problemwith an old Flash file I've usedfor 10 years So I have a flash 6 swf file living in my media directory at http://www.wealthcoachinguk.com/wp-content/uploads/2012/0

  • My iMac OS X wont load

    When I turn on my iMac desktop it blinks a gray globe for serval seconds and then goes to the apple icon. Under the apple icon a loading circle spins maybe once or twice, then my screen goes gray and says you may need to restart your computer by hold

  • New Ipad mini installing app issues

    Please help. I have purchased a new iPad mini today. I have spent the last few hours getting annoyed as to why I can't install any apps on it. This ipad is for my wife. I already have an iPad 2 and have never had issue with it. Everything else seems

  • Can't transfer apps from Mac to iPhone using iTunes

    I need to transfer an app from my Mac to my iPhone because the vendor bodged an update. I've deleted the broken app from the iPhone and now want to sync apps with my Mac as it has a working copy of the app. However when I go to the syncing screen the