Listbox focused row when more items selected

Hi, I have following problem. I'm using ListBox with multiple rows selection enabled. I want to identify the row that's focused even when it's not selected. It's shown on attached pictures.
I'll appreciate any kind of help
Bye
jochynator
LV 8.0.1, WinXP Pro
Attachments:
active_row.vi ‏10 KB
active_row_example.PNG ‏3 KB
active_row_example2.PNG ‏3 KB

Hi Andy,
I want to know which item was selected as last to draw the correct datafile - last chosen. It would be easy when having ListBox allowing to select only one row, but I want to have opportunity to select more items, when I want to delete more datafiles from memory.
jochynator
LV 8.0.1, WinXP Pro
Attachments:
ListBox_chose_item.vi ‏18 KB

Similar Messages

  • Automatic batch determination when more items have the same material

    Hi guys,
    I have a problem with automatic batch determination in the delivery note where more items has the same material number.
    For example:
    Sales order items
    Item   Material   Q
    1        130         5 kg
    2        130         4 kg
    Stock for this storage location is:
    material    batch    Q
    130           1000     3kg
    130           1001     7kg
    When I create delivery note I get this:
    Item   Material   Q   Batch
    1       130            
    90001 130       3     1000
    90002 130       2     1001
    2       130
    90003 130       3     1000
    30004 130       1     1001
    As you can see, both items has the same batches. This is not good, when post goods issue. Normally there is no stock availaible for both items.
    Is there any customizing to do this correctlly?
    Thanks for an ansver.
    BR, Matic

    What is the purpose of giving the same material as second line item.
    specify in the first line item itself.
    or els the condition record which you have specified that for 100 material of A gives 10 material of B modify it to 10 of A should give 1 material of B
    The first you will be useful for you.

  • PlD Distorted when multiple Item selected

    Hi ,
    In our Scenario we want to print Item description,serial no, qty  on same page in PLD for multiple Item with single quantity Print Layout is coming without distortion but when multiple item with multiple quantity it goes to next page and some data (Item Description and Qty ) for the last item on First page gets repeat on next page also Borders get distorted in print
    So how to fix this issue of data repeating and also how give page border to Print Layout

    Just as a note to clarify for all of these posts here.
    The real answer is that you can print the serial/batch number right on the main document.  You don't need to use the serial number transaction report at all.  You can disable it in print preferences (Administration >> System Initialization >> Print Preferences).
    In order to print the serial numbers relating to a document you need to use special system variables.  Just make a new field and then make it a system variable and use the following variables.  They need to be put on the same line as the regular detail info and the data will grow if there are multiple batches or serial numbers so make sure you allow for field adjustments.
    490          TEXT     serial number
    492          TEXT     batch number
    493          TEXT     warehouse code (batch/SN)
    494          MONEY (QUANTITY)     quantity (Batch/SN)
    495          DATE     admission date (receipt)
    496          DATE     date of production set by manufacturer (for Batch/SN)
    501          DATE     expiration date (for Batch/SN)
    502          TEXT     details (for Batch/SN)
    Hopefully this helps.
    Mike
    PRIELL.com

  • Extended notifications: more items selected than expected

    i have configured SWNCONIFG for only one task and i know how many instances there were created in the system. when i run SWN_SELSEN and check WF/NOTIFICATIONS in SLG1, however, i see workitems ids that are for different tasks. i have removed all the prior task filter configurations and started from scratch, but the 'old' items keep coming back and some of them seem random as i don't recall ever creating any tasks for them.
    is there a cleanup utility or do i have tor resort to a surgical procedure directly on the SWN_NOTIF table?
    i'm only trying to avoid surprises during the go-live.

    Gregory,
    did you ever get an answer to this question.  I am seeing the exact same issue despite having filters configured to only pull one specific task...i still see others tasks in SWN_NOTIF and i can see from the application logs that the system is attempting to send those notifications. 
    if you have resolved what was your ultimate solution to this?
    thx

  • How to Select the Current Row When Using af:iterator?

    Hello all,
    I encounter the following problem when using af:iterator to display data from
    a View Object:
    When trying to display the content of a row via a popup, only the first row is
    returned no matter which row is selected. So a selection of the current row
    should exist or some other method which should allow the access to the
    current row.
    The af:table has a selectionListener attribute which permit to achieve this.
    Does anyone know about some similar attribute or some method for
    selecting the current row when the af:iterator is used?
    Thank you,
    Mirela

    I would be interested in the answer to this basic question as well. I cannot get the selected row value of an attribute in an iterator for a view if I simply set-up a attribute binding to the iterator. It seems that this should be possible. I've had no other option but to obtain the current row and the related attributes programmatically. This works fine, but if there is a more elegant option, then I'd certainly like to use it.
              <af:table value="#{bindings.CompaniesView1.collectionModel}"
                            var="row"
                            rows="#{bindings.CompaniesView1.rangeSize}"
                            emptyText="#{bindings.CompaniesView1.viewable ? 'No data to display.' : 'Access Denied.'}"
                            fetchSize="#{bindings.CompaniesView1.rangeSize}"
                            selectedRowKeys="#{bindings.CompaniesView1.collectionModel.selectedRow}"
                            rowBandingInterval="0" id="tCompanies"
                            summary="Companies"
                            width="100%"
                            rowSelection="single"
                            binding="#{CompanyBackingBean.companiesTable}">Page Def:
        <attributeValues IterBinding="CompaniesView1Iterator" id="Id">
          <AttrNames>
            <Item Value="Id"/>
          </AttrNames>
        </attributeValues>I should be able to get the Id attribute value of the current selected row using "#{bindings.Id}", right? Well, it doesn't work for me. Any ideas?
    Thanks

  • Update JTable when an item is selected in a JComboBox inside the same JTabl

    I created a JTable with a lookup JComboBox. I want to update values from the table when an item is selected in the ComboBox.
    I tried all the events posible in JComboBox, but I can not fire to update the JTable.
    Please if you have a how-to, (source) will help. Thanks.
    Regards,
    -Rory

    I tried that. But it only fires when the JComboxBox, lost the focus. And not in the "itemChange" event. How to do it width that event?
    I want something like "intemChange" event, to fire the JTable.fireTableChangeUpdate(); ... I send the code.
    * @author rory
    public class PeriodenDauerGrid extends JPortSimTable implements Serializable, ActionListener {
         * generated id
        private static final long serialVersionUID = -5270969898251578932L;
        public PeriodenDauerGrid() {
            super();
        @Override
        protected void initComponent() {
            super.initComponent();
            setModel(new PeriodenDauerGridTableModel());
            setDefaultEditor(String.class, new PeriodenCellEditor(this));
            setDefaultRenderer(String.class, new PeriodenCellRenderer());
        public void actionPerformed(ActionEvent e) {
            // HERE should fire the table update.
            // JOptionPane.showMessageDialog(null, "HOLITA!");
            PeriodenDauerGridTableModel model = (PeriodenDauerGridTableModel) getModel();
            model.fireTableDataChanged();
            updateUI();
    class PeriodenCellRenderer extends JLabel implements TableCellRenderer {
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
            setHorizontalTextPosition(SwingConstants.CENTER);
            setHorizontalAlignment(SwingConstants.CENTER);
            if (row == 1) {
                setOpaque(true);
                setBackground(GuiConstants.PANEL_COLOR);
            } else {
                setOpaque(false);
                setBackground(GuiConstants.CELL_EDITOR_COLOR);
            if (value instanceof Date) {
                Date n = (Date) value;
                // String.format(format, args)
                String s = String.format("%1$td.%1$tm.%1$tY", (Date) value);
                setText(s);
            } else {
                setText(value == null ? "" : value.toString());
            return this;
    class PeriodenCellEditor extends AbstractCellEditor implements TableCellEditor {
        private JComboBox combo = new JComboBox(new String[] { "7", "84", "182", "364" });
        private JTable table = null;
        public PeriodenCellEditor(PeriodenDauerGrid table) {
            combo.addActionListener(table);
            this.table = table;
        public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
            combo.setSelectedItem(value.toString());
            return combo;
        public Object getCellEditorValue() {
            return combo.getSelectedItem();
    }

  • Focus when an item is not valid

    Hi,
    This is the procedure called from trigger WHEN-VALIDATE-ITEM
    PROCEDURE Validate_item IS
      LC$Value   Varchar2(512) := :System.Cursor_Item ;
      FL$Value   Varchar2(2)   := :System.Cursor_Value ;
      LC$Code   Varchar2(2)   := '';
    BEGIN
      If LC$Value IS NULL Then
             goto the_end ;
      End if ;
      If FL$Value IS NULL Then
             goto the_end ;
      End if ;
      -- For code validation --
      Begin
         Select MYTABLE.T_CODE
         Into LC$Code
         From   MYTABLE
         Where  T_CODE = FL$Value;     
      Exception
            When NO_DATA_FOUND Then
              Disp_Alert(3); -- Call the alert procedure
      End ;
    <<the_end>>
    Null ;
    END; When the code is not valid, a message is displayed with disp_alert, but the cursor go to next item.
    How can I keep the focus in the invalid field ?
    I have tried with Go_Item(:system.cursor_item) but error FRM-40737 occur.
    Best Regards
    Gaetano

    Read the following:
    Timer / Go_Item workaround - replacement for web?
    Greetings...
    Sim

  • Display a message when  an item is selected from a dropdownlist

    Hi,
    I need to display a message(kind of alert message) when certain items are selected from the dropdownlist.
    Let me know what is a good way to do this in web elements?
    Thanks

    hello,
    unfortunately there is no validation / alerting for select menus in webelements.
    however...if you're feeling ambitious and or this is a definite requirement for your project...custom functions are open source so you could write an on change javascript function within the WESelect custom function that will find the new value and compare it against your certain items array of values.
    out of curiosity, what is your project's particular need to have an alert for a select menu based on what the end user selects? if this comes up more often or there's a good use case perhaps this could be built into a future version.
    jw

  • Wcf Data Service fails when more than 8properties  in the 'select=' portion

    Hi:
    I am using WCF Data Service and Oracle
    EF Provider is ODAC11.2 Release 4
    Wcf Data Service fails when more than 8 properties are specified in the 'select=' portion of the URI
    here is my code
    var q = from c in this.ctx.SALESORDER_ITEM
    select new
    c.SORDERDETAILID,
    c.IID,c.DMFLAG,c.OWNERID,c.SKUID,c.SKU_ID,c.TRADENO,c.SOURCEID,c.SORDERID
    excetion:
    InvalidOperationException: An error occurred for this query during batch execution. See the inner exception for details
    The inner exception is null, but the DataServiceClientException states: Value cannot be null Parameter name: value
    the exception is thrown in base.OnStartProcessingRequest(args) method (overridden).
    Here is the call stack as well:
    at System.Data.Services.WebUtil.CheckArgumentNull[T](T value, String parameterName)
    at System.Data.Services.Internal.ProjectedWrapper.set_PropertyNameList(String value)
    at lambda_method(Closure , Shaper )
    at System.Data.Common.Internal.Materialization.Coordinator`1.ReadNextElement(Shaper shaper)
    at System.Data.Common.Internal.Materialization.Shaper`1.SimpleEnumerator.MoveNext()
    at System.Data.Services.Internal.ProjectedWrapper.EnumeratorWrapper.MoveNext()
    at System.Data.Services.DataService`1.SerializeResponseBody(RequestDescription description, IDataService dataService)
    at System.Data.Services.DataService`1.HandleNonBatchRequest(RequestDescription description)
    at System.Data.Services.DataService`1.HandleRequest()
    Is there a max number of properties in $select statement
    I think may be it is oracle provider's problem ,but i don't konw how to debug it Can anyone help me
    Any help is greatly appreciated

    I believe the null/empty string issue is unrelated to the 8 column issue, at least for ODP.NET. For example, let's take the original query in the OBE:
    http://.../yoursvcfile.svc/EMPLOYEES?$select=EMPLOYEE_ID,FIRST_NAME,LAST_NAME,SALARY,DEPARTMENT_ID,DEPARTMENT,EMAIL,PHONE_NUMBER,MANAGER_ID
    Let's make all the columns selected not nullable. You can do this with the Oracle Dev Tools. Specifically, PHONE_NUMBER and FIRST_NAME are the only nullable fields. I make them non-nullable and re-run the query and the same error occurs. Thus, these values should never be made null. Moreover, in all 107 rows, none of these row values consist of empty strings anyway.
    Looking into the problem further, WCF DS is calling methods in the System.Data.Services.Internal namespace.
    http://msdn.microsoft.com/en-us/library/system.data.services.internal.aspx
    Specifically, we see your issue when the ProjectedWrapperMany method is called. You will notice that there is ProjectedWrapper0, ProjectedWrapper1...ProjectedWrapper8 methods also present in the same namespace. As soon as the number of columns exceeds 8, ProjectedWrapperMany is called and we see the error. We're going to ask MS to help analyze the issue since this is an .NET-internal method being called.

  • Error Occur when trying to select Item List

    Hi Experts,
    Machine gets Hang when trying to select Item List  in  row level PO,SO ect as well as in item master Data when Pressing Star ( * ) .
    and when trying to close this window then error occur as close the program and problem occur on server itself
    Test Database is working fine.
    worked around
    1.Restarted  the machine
    2.Restarted services
    using SBO 9.0 PL 7
    OS-Window 7 Professional
    Please Find the Two Error Attachments
    Please help me
    Thanks & Regards
    Navnath

    Hi
    Check the below thread
    SAPB1 Application Hang and Not responding when i serch item in any document
    With Regards
    Balaji Sampath

  • SSRS 2012 (SP Integrated) report on SP 2013 PerformancePoint Dashboard: when too many filter items selected together report does not update anymore!

    I am having a situation with SSRS 2012 (SP-integrated) report rendered on SP 2013 PerformancePoint Dashboard using linked PerformancePoint (PP) filters.
    The report works fine as long as too many PP filter items are not selected at the same time. When gradually selecting more items from the filter, the report updates itself until more than a sepecific numer of filter items are selected - the report simply
    does not update itself anymore. This "specific number of filter items", when hit, generates the following error in ULS:
    An exception  occurred while rendering a Web control. The following diagnostic information might help to determine the cause of this problem:  System.UriFormatException: Invalid URI: The hostname could not be parsed.    
     at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)    
     at System.UriBuilder..ctor(String uri)    
     at Microsoft.PerformancePoint.Scorecards.ServerRendering.ReportViewControl.ReportUrl(SqlReportViewData sqlReportViewData)    
     at Microsoft.PerformancePoint.Scorecards.ServerRendering.ReportViewControl.RenderSqlReport(TextWriter writer, ReportView sqlReportView)    
     at Microsoft.PerformancePoint.Scorecards.ServerRendering.ReportViewControl.RenderReportViewControl(HtmlTextWriter writer, ReportView rv)  PerformancePoint Services error code 20700.
    I already know that the cause of the issue is in the length of the query (perhapse RDL or MDX) that the browser is supposed to pass on to the instance of SSAS.
    Some people had suggested a workaround that was suitable for older versions or non-integrated SSRS (see here: http://social.msdn.microsoft.com/Forums/sqlserver/en-US/cb6ede72-6ed1-4379-9d3c-847c11b75b32/report-manager-operation-cannot-run-due-to-current-state-of-the-object).
    Knowing this, have already done the changes suggested (adding the lines suggested to SP's web.config for Reporting and the web.config of the site on which report is rendred) at no avail, just to make sure.
    I have rednered the same report on the same dashboard using SSRS filters and there is no problem; it just works fine. This has to be a bug in PP that is causing this.
    Has anyone had the same problem with SSRS 2012 (SP-integrated) report rendered on SP 2013 PP dashboard using PP filter? Any fixes or workarounds?
    thnx!

    Hello everybody.
    I confirm the issue in Service Pack 1 Release 2.
    Poor workaround is to remove the repeated infromation from the member keys (in SSAS they can be really long).
    The issue seems to be specific to SSRS: Excel Services works well with the same filter.
    Sergey Vdovin

  • Cannot have multiple items selected in a DropDownList when edit the forum in sharepoint

    hi ,
    i  have custom forum for new and edit, in new forum we have controls drop down values, when select drop down1   values that related values are displayed in dropdown2 , when edit  item  that  time we getting error
    Cannot have multiple items selected in a DropDownList.
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
    Exception Details: System.Web.HttpException: Cannot have multiple items selected in a DropDownList.
    Source Error:
    HttpException (0x80004005): Cannot have multiple items selected in a DropDownList.]
    System.Web.UI.WebControls.DropDownList.VerifyMultiSelect() +124
    System.Web.UI.WebControls.ListControl.RenderContents(HtmlTextWriter writer) +10956501
    System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +42
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +240
    System.Web.UI.WebControls.WebControl.RenderContents(HtmlTextWriter writer) +13
    System.Web.UI.WebControls.WebControl.Render(HtmlTextWriter writer) +42
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +240
    System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +42
    ASP._controltemplates_amat_appayrequest_webparts_appayrequest_appayrequestusercontrol_ascx.__Render__control1(HtmlTextWriter __w, Control parameterContainer) in c:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\TEMPLATE\CONTROLTEMPLATES\AMAT.APPayRequest.Webparts\APPayRequest\APPayRequestUserControl.ascx:350
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +115
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +240
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +240
    System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +42
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +240
    System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +253
    System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +87
    System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +53
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +240
    System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +42
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +240
    System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +240
    System.Web.UI.Page.Render(HtmlTextWriter writer) +38
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4240

    Hello,
    Could you please share your code with us? Also explain how you are binding DDL.
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • When does a selection in a text field in a Finder window lose focus?

    Hello,
    this problem has emerged on account of an Applescript file that needs to access a text selection (portion of a filename highlighted) in an open Finder window.
    The bare minimum code to demonstrate the problem is this:
    *tell application "System Events"*
    * *tell process "Finder"*
    * *set selText to value of attribute "AXSelectedText" of text field 1*
    * *end tell*
    *end tell*
    other variants also exist, using "keystroke" but that does not work either. I am not asking help with Applescript here, it is here only to give a sense of the problem.
    My conclusion thus far is that the selection lose focus before the script process can access it. In the best case I get the full filename by using "attribute" and copy of the alias onto the clipboard by using "keystroke".
    So my problem is this:
    It seems that the focus stays alive when one clicks on a menubar item, any click on any other item on the desktop, including windows of irrelevant applications, changes the focus from the selection within the text field corresponding to a filename, to the filename itself.
    And my question is this:
    Is there a changeable setting within the OS that has to do with how long the focus stays alive on a selection within a text field corresponding to a filename? If yes, how do I change it?
    Thanks

    baltwo wrote:
    Thanks for clarifying. Never heard it called a text field, just a label. So, exactly what are you trying to accomplish? Is it that you want AS to select the file, highlight its label so you can edit/change it with some other text? If so, have you checked out the Finder scripts installed on the machine, especially the Finder script *Add to Finder Names*?
    UI Element Inspector calls the activated/editable filename a text field.
    Actually I want to modify one of the stock Finder scripts. I want to be able to select part of the file name in the active text field of the Finder window, then activate the script, *have the script pick up the selection* as a text string then use it internally.
    The bolded step is the one in question.
    Every attempt fails on the fact that the focus is lost from the "text field" and it reverts to the label for the filename, if I may use this distinction, (or to "FinderItem" in the parlance of UIEI) as soon as another process begins, it seems. So when the script becomes active, but before any of the commands is executed, the selection disappears.
    My guess is that it is not some absolute necessity but a setting that perhaps can be changed somehow.

  • Error "One or more items can't be copied" when backing up to USB hard drive

    I just bought a 160 GB USB2 external hard drive for use with my PowerBook. It seems to work just fine for the most part, as long as I'm working with one or two files at a time.
    One motivation for the purchase, however, was backups. The first thing I wanted to back up was my home folder. Feeling like the savvy Macintosh user I logged out of my account and logged back in as the root user, and dragged my Home folder to the external HD. After watching it "prepare" to copy for a few minutes it started. Then stopped almost immediately with the warning "One or more items can't be copied. Do you want to skip them and copy the remaining items?"
    Seeing as how I didn't know which items stopped the copy, I didn't want to skip them. A backup with holes is not a backup.
    Thinking I'd bitten off too much, I started moving one folder at a time. Music, Documents, etc. But each folder ran into the same error.
    I've tried dragging folders over from inside my own account, thinking that perhaps root (yes, I know this sounds absurd) didn't have privlidges. No go, I still run into the error, even when copying files I know aren't in use (my Music folder, for example, when iTunes isn't running).
    I have way too much in that folder to drag individual files for backup. Can someone please tell me what I am doing wrong? I have another 10 days to return this HD, and if I don't get this working soon I see no reason to keep it.

    This problem can occur for several reasons. One, is that you aren't logged in as the root user. Keep in mind that your admin account does not convey root user privileges. Second, when trying to copy system files that are in use you will get that error. Third, you cannot make a proper clone of your system using drag and drop. Instead do the following:
    First, prep the external drive properly:
    1. Open Disk Utility in the Utilities folder of your Applications folder.
    2. After DU loads select your hard drive (this is the entry with the mfgr.'s ID and size) from the left side list. Click on the Partition tab in the DU main window.
    3. Set the number of partitions from the dropdown menu (use 1 partition unless you wish to make more.) Set the format type to Mac OS Extended (Journaled, if supported.) Click on the Partition button and wait until the volume(s) mount on the Desktop.
    4. Select the volume you just created (this is the sub-entry under the drive entry) from the left side list. Click on the Erase tab in the DU main window.
    5. Set the format type to Mac OS Extended (Journaled, if supported.) Click on the Options button, check the button for Zero Data and click on OK to return to the Erase window.
    6. Click on the Erase button. The format process will take 30 minutes to an hour or more depending upon the drive size.
    Next, create the clone:
    1. Open Disk Utility from the Utilities folder.
    2. Select the startup volume from the left side list.
    3. Click on the Restore tab in the DU main window.
    4. Drag the startup volume to the Source entry field.
    5. Select the backup volume from the leftside list and drag it to the Destination entry field.
    6. Double-check you got it right, then click on the Restore button.
    Keep in mind that according to Apple you cannot start up OS X from a USB drive. If one of your goals was to be able to boot from the external drive, then you should have purchased a Firewire drive.

  • How to set by code items selected in  listbox

    I have a listbox in which user can make multiple selections.And I have a button which make a specific action but it is clicked I want that the selected Items in the listbox remain selected.
    Due to the fact that the page is reloaded after the click on the button the listbox is populated without having any selected item.
    How can I do this please.
    Thanks in advance.

    I'm not positive I understand your question completely but I am going to take a guess that your asking how to make a command button do its action while not affecting your listbox.
    This is really a tricky problem because i'm assuming these two components are sharing the same form.
    The easiest solution would be to create two separate forms for each. The solution for a single form would be to capture the state that the listbox is in which is a little more difficult.

Maybe you are looking for