Removing Components from display

Hi,
I have a JPanel with a number of JLabels inside.
All visible on the screen.
I want to remove all the JLabels (permanently), so I call:
jPanel.removeAll();   
jPanel.validate();Yet the JLabels do not disappear from the screen.
Any ideas on this appreciated.
Ta.

jPanel.removeAll();
jPanel.invalidate();
jPanel.validate();
jPanel.repaint();Thanks. That does the trick. I didn't realize it was necessary to use both validate and repaint.

Similar Messages

  • Facing problem with the code for sending an .xls attachment via email, a field value contains leading zeros but excel automatically removes these from display i.e. (00444 with be displayed as 444).kindly guide .

    Facing problem with the code for sending an .xls attachment via email, a field value contains leading zeros but excel automatically removes these from display i.e. (00444 with be displayed as 444).kindly guide .

    Hi Chhayank,
    the problem is not the exported xls. If you have a look inside with Notepad or something like that, you will see that your leading zeros are exported correct.Excel-settings occurs this problem, it is all about how to open the document. If you use the import-assistant you will have no problems because there are options available how to handle the different columns.
    Another solution might be to get familiar with ABAP2XLS-Project. I got in my mind, that there is a method implemented, that will help you solving this problem. But that is not a five minute job
    ~Florian

  • Remove Components from Library

    I'm new to Catalyst, so this might be a stupid question.
    I created a bad datalist and as soon as I realized my error I deleted it from the Artboard, but it is still in my Library. Now every time I run the project I get an alert that says that DataList1 is missing a required part and will produce an error.
    I don't need DataList1 and I'm not really interested in fixing it. In the current build of the application, is there a way to just remove this component from my library so that I don't have to deal with the error anymore?
    Thanks.

    Currently you cannot remove components from the library panel, but this is something we are working on. There is a temporary solution though: switch to code view and you'll see a panel on the right side of the screen that shows all the files in your project. In the components folder there should be a DataList1.mxml file. Right click on it and choose delete.
    Note that if you follow the above steps and delete a component that is used elsewhere in your project, your application won't compile.

  • Problem removing components from JLayeredPane

    Hi all,
    I have a problem showing and hiding components on a JLayeredPane. It goes Something like this:
    In my application I have a button. When this button is pressed I use getLayeredPane to get the frames layered pane. I then add a JPanel containing a number of labels and buttons onto that layered pane on the Popup layer. The panel displays and funcitons correctly.
    The problem comes when I try to remove the panel from the layered pane. The panel does not dissappear and I am no longer able to click on anything else in the frame!
    If anyone has any ideas how to get around this or what the problem might be I'd be very greatful to hear it. Sample code follows:
          * Called when the button on the frame is pressed:
          * @param e
         public void actionPerformed(ActionEvent e)
                    JLayeredPane mLayredPane = getLayeredPane();
              int x = 0, y = 0;
              Container c = this;
              while (true)
                   c = c.getParent();
                   if (c != null)
                        x += c.getLocation().x;
                        y += c.getLocation().y;
                        if (c instanceof JRootPane)
                             break;
                   else
                        break;
              mPanel.setBounds(x, y, 235, 200);
              mLayredPane.add(mPanel, JLayeredPane.POPUP_LAYER);
    //And when a listener fires from the panel I use
    mLayredPane.remove(mPanel);
    //To remove it from the layered pane and in theory return the
    //app to the state it was before the panel was displayedThanks again...

    The problem is you only removed it within the program, without actually removing it from the display. If that makes any sense, or whether thats your problem at all.
    If you are only using this line.
    mLayredPane.remove(mPanel);
    I think if you tell it to repaint and revalidate it should work, though i have never used LayeredPane.
    mLayredPane.repaint();
    mLayredPane.revalidate();

  • MSS - How to remove retirees from displaying in MSS

    Hello,
    Does anyone know the best approach to exclude retirees (PA000.STAT2 = 2) from displaying in MSS?  We currently keep retirees in the org unit they retired from using creating a clone of their current position number to a new position number that starts with 991 or 993.  Terminated employees are put in position 99999999 and since there is OM relationships, those do not show up.
    Thank you,
    Keith Pieritz

    ya you can   make the settings in view T77S0 for only active employees keep as 3 u can achive it
    go to sm30 v_t77s0 create new entries enter values as :-
    a) Access the V_T77S0 view.
    b) Choose New Entries.
    c) In the Group field (group name), enter ESS.
    d) In the Sem. Abbr. field (semantic abbreviation) enter STAT2 .
    e) In the Value Abbr. field (value of semantic abbreviation), restrict the number of employees covered by the search by entering the relevant employment status for the search.
    save it  ....and once chk in portal after reloggin in

  • Remove decimal from displaying in prices?

    I would like to remove the decimal from my product price so it will be displayed Kr.390  or my first choice if anyone knows how to solve it is Kr. 390,-
    Costs are now presented Kr.290,00 that is not correctly.
    Hope someone has a solution to this ...

    Here's a link that contains a simple code snippet that will do this for you - http://www.twoblokeswithapostie.com/blog/2013/05/27/eliminating-decimals-product-prices-bu siness-catalyst/
    You may have to replace . with , in price = price.split("."); if your prices have a comma in them instead of a dot.
    Cheers,
    Mario

  • Customizing Audit Log Report - Adding/Removing Columns from Display

    Hi All -
    Has anyone tried adding/removing the columns from Out of Box Auditi Log report with minor customizations to the code/configuration files ? Right now , when the Audit Log report is executed, there are numbe of columns that appear on report (Server, Client IP etc) which are too technical for the client and requirement is remove some of these and add some more for the attributes that we are audit logging through Audit workflow service. If you have done something similar in the past, please provide me with some inputs. Any sample code, examples will be highly appreciated.

    Hello Gurus,
    I also have same kind of requirement.WE have to send a monthly report to customer where number of users created and deleted to be given to them.
    Its urgent.Please help
    Thanks in advance

  • Removing components from  a  J panel Help?

    I have a J Panel which has on it a stack of 10 components which are composed
    of either jComboboxes or textfields. Duridng program operation I need to clear the panel and then
    add the components again in different locations depending on user selection.
    Problem is I can't seem to get rid of the comboboxes. I am trying a removeAll and then
    reinitializing/rebuilding with all text fields but the combobox won't go away.
    I have used various combinations of
    Even if I just do the removeAll the underlying panel jPanel2 does not clear itself completly
    jPanel2.validate();
    jPanel2.invalidate();
    jPanel2.doLayout();
    Nothing seems to work yet
    Help??

    You can try remove () and then call repaint, unless you've done that...

  • ObjectNotFoundException while removing Portlet from display

    Hi,
    My requirement on Personalization is to display all Portlets(names) with Checkboxes, user can decide which portlets to be displayed/not.
    I'm using streaming mode.
    I have 2 methods to do this: getPageView and removePlaceableInstances.
    I'm getting the following exception:
    <pre>com.bea.netuix.application.exception.ObjectNotFoundException: [Primary desktop] with id [Webapp: [myGearbox] PortalPath:
    [personalization] DesktopPath: [personalize.jsp]] could not be found in the database.
    at com.bea.netuix.application.manager.persistence.jdbc.DesktopInstanceDelegate.createDesktopInstance(Ljava.sql.C
    onnection;Lcom.bea.netuix.application.identifier.DesktopDefinitionId;Ljava.lang.String;)Lcom.bea.netuix.application.inst
    ance.internal.DesktopInstanceInternal;(DesktopInstanceDelegate.java:458)
    at com.bea.netuix.application.manager.persistence.jdbc.DesktopInstanceDelegate.getCreateDesktopInstance(Ljava.sq
    l.Connection;Lcom.bea.netuix.application.identifier.DesktopDefinitionId;Ljava.lang.String;)Lcom.bea.netuix.application.i
    dentifier.DesktopInstanceId;(DesktopInstanceDelegate.java:1012)</pre>
    I have attached the code here with for reference.
    <pre>public class PersonalizationUtil
    public static PageView getPageView( String pageInstanceId, String webAppName, String portalPath,
    String desktopPath, Locale locale, HttpServletRequest request ) {
    PortalCustomizationManager cmgr = PortalBeanManager.getPortalCustomizationManager();
    PageDefinitionManager pmgr = PortalBeanManager.getPageDefinitionManager();
    try
    return PortalManager.getPageView( pageInstanceId, webAppName, portalPath, desktopPath, true, locale, request );
    catch( Exception e )
    System.out.println( "PortalVisitorManager - " + e );
    return null;
    public static void removePlaceableInstances( String placeableId, String webapp, String portalPath,
    String desktopPath, HttpServletRequest request )
    placeableId = "portletCompanyStore_1";
    try {
    PortalCustomizationManager cmgr = PortalBeanManager.getPortalCustomizationManager();
    PageDefinitionManager pmgr = PortalBeanManager.getPageDefinitionManager();
    //AppContext ac = AppContext.getAppContext(request);
    CustomizationContext customizationContext = new CustomizationContext(request);
    customizationContext.setVisitorMode(true);
    DesktopView desktopView = cmgr.getDesktopView(customizationContext, webapp, new PortalPath(portalPath), new DesktopPath(desktopPath));
    System.out.println("desktopview - " + desktopView);
    DesktopDefinitionId ddId = new DesktopDefinitionId( webapp, new PortalPath( portalPath ), new DesktopPath( desktopPath ) );
    //customizationContext.setUserDesktopInstanceId(
    InitialContext ic = new InitialContext();
    PageDefinitionManagerHome home = (PageDefinitionManagerHome) PortableRemoteObject.narrow(ic.lookup("java:comp/env/ejb/PageDefinitionManager"), PageDefinitionManagerHome.class);
    PageDefinitionManager mgr = home.create();
    PageDefinition homePageDefinition = mgr.getPageDefinition(customizationContext,
    "home",
    webapp);
    PageView homePageView = mgr.getPageView(customizationContext,homePageDefinition.getPageDefinitionId());
    PageView usersHomePageView = PersonalizationUtil.getPageView(homePageView.getPageDefinitionId().toString(),webapp,portalPath,desktopPath,request.getLocale(),request);
    PlaceableInstance placeableInstance = usersHomePageView.getPortletView(placeableId).getPlaceableInstance();
    System.out.println("NNINFO: PlaceableInstance - " + placeableInstance);
    //PageView usersHomePageView = (PageView) request.getAttribute("usersHomePageView");
    if ( usersHomePageView != null ) {
    //PlaceableInstance placeableInstance = usersHomePageView.getPortletView("portletCompanyStore_1").getPlaceableInstance();
    cmgr.removePlaceable( customizationContext, new DesktopDefinitionId( webapp, new PortalPath( portalPath ), new DesktopPath( desktopPath ) ), placeableInstance );
    } else {
    System.out.println("nulll");
    } catch (Exception e) {
    e.printStackTrace();
    }</pre>
    Am i doing anything wrong??
    Any help or hint would be greatly appreciated!!
    Thanks,
    -Nach.

    Chris, Thank you very much for your valueable inputs.
    Now i have changed the code as per your inputs.
    I'm currently getting PortalCustomizationManager as follows:
    PortalCustomizationManager cmgr = PortalBeanManager.getPortalCustomizationManager();
    1) Is this the right way?
    CustomizationContext customizationContext = new CustomizationContext(Locale.US,request);
    customizationContext.setVisitorMode(true);
    DesktopView desktopView = cmgr.getDesktopView(customizationContext, webapp, new PortalPath(portalPath), new DesktopPath(desktopPath));
    System.out.println("desktopview - " + desktopView);
    But desktopView is null.......
    2) What could be the possible reason?
    Also in the JSP,
    AppContext ac = AppContext.getAppContext(request);
    if (!ac.isDotPortal()) {
    String currentWebAppName = ac.getWebAppName();
    String currentDesktopPath = ac.getDesktopPath();
    String currentPortalPath = ac.getPortalPath();
    currentDesktopPath and currentPortalPath are null....
    Hence i'm getting the desktopPath and portalPath as follows:
    String pathInfo = request.getPathInfo();
    String portalPath = pathInfo.substring(1, pathInfo.lastIndexOf("/"));
    String desktopPath = pathInfo.substring(pathInfo.lastIndexOf("/") + 1, pathInfo.length());
    3) What is the right approach to get portalPath and desktopPath. If i should get the desktopPath and portalPath from AppContext, then what could be the possible reasons for getting null.
    Again, your inputs are more valueable and crucial to me now.
    Thanks
    -Nach.

  • Removing wildcard(%) from display

    Whenever we create a condition on a character or varchar item(field) discoverer by default adds the message 'use % for wildcard' along with the custom prompt. How do I remove this message? We have few reports which return huge amounts of data. so we want to hide the option of wildcard character from user.
    Thanks

    Hi
    Now I understand and see where you are going with this. You are saying that it would be perfectly ok for a user to use % in one of the conditions, just not in all of the conditions.
    We can use a new condition to check this and prevent the query from running although we cannot give the user a nice message. All we can do is stop the query from running and return no data.
    Create this calculation called Test_Values:
    CASE WHEN :Param1 = '%' AND :Param1 = :Param2 THEN 0 ELSE 1 END
    Create a new condition:
    1 = Test_Values
    Now if the user keys % into all parameters the calculation called Test_Values will return 0 and hence 1 = Test_Values will return false which will cause the query not to execute.
    Hope this helps
    Regards
    Michael

  • Removing scratches from display screen

    I know they advertised this stuff on TV that magically fills in the scratches on your glasses...do you think it will work on the screen? Do you have a better product to remove them?

    I find it hilarious when persons such as yourself just make things up in complete oblivion. The warranty does N-O-T cover scratches. And... How did he get scratches on his screen, you ask? Because the material that covers the front of the iPod checks in at about a 1 on the hardness scale.
    To the OP... I suggest you Google...
    Ice Cream
    Apple Sauce
    iKlear
    Brasso
    All four should work fine.
    After removing the scratches, I highly suggest you purchase a screen cover...
    The Invisible Shield is known to do wonders.
    Good luck.

  • Every time I open a new Tab the Yahoo Web Search page appears. How do I remove Yahoo from displaying content on each Tab I open?

    I am able to select the website I wish to appear as my Home Page when I open my Firefox browser. However, each time I open a New Tab it opens up to a page showing the YAHOO Web Search Bar. Each and every subsequent Tab opens up showing the Yahoo information. Please Help me DELETE YAHOO ...

    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.com/kb/Safe+Mode
    *https://support.mozilla.com/kb/Troubleshooting+extensions+and+themes

  • How to Remove Components

    Hi,
    This is RamBadri here is a problem Iam facing that is how to remove components from Intigration Repository(IR).
    any body will give the answer to my problem,it would help alot for me.
    Thanks & Regards,
    Ram.

    Hi ML R,
    This blog will solve your problem
    To delete software component:
    /people/siva.maranani/blog/2005/05/22/how-to-delete-software-component-from-integration-builder
    cheers,
    Prashanth
    P.S Please mark helpful answers

  • Remove panel from frame

    CONTINUATION OF 1St MAIL
    public JScrollPane ThumbnailGui(Vector vSeriesNo,Vector[] vImageNo,Vector[] LoadedFilenames)
              this.parent=parent;
              this.vSeriesNo=vSeriesNo;
              this.vImageNo=vImageNo;
              this.LoadedFilenames=LoadedFilenames;
                   try{
              MainPanel=new JPanel();
              MainPanel.setLayout(new BoxLayout(MainPanel,BoxLayout.Y_AXIS));
              LineBorder lineborder=new LineBorder(Color.red,2,true);
              MainPanel.setBorder(lineborder);     
              int LoadedFilenamesSize=LoadedFilenames[0].size();
              int LoadedSeriesSize=vSeriesNo.size();
              System.out.println("*******Im under Thumbnial GUI");
              Thumbnail=new JButton[LoadedSeriesSize][LoadedFilenamesSize];     
              for(int count=0;count<1;count++)
                   System.out.println("Vector creation");
                   vImageNo1[count]=new Vector();
                   LoadedFilenames1[count]=new Vector();
                   for(int j=0;j<vSeriesNo.size();j++)
                        for(int i=0;i<vImageNo[j].size();i++)
                             str=LoadedFilenames[j].elementAt(i).toString().replace('~','\\');
                             str=str.replace(".dcm",".jpg");
                             Icon ic=new ImageIcon(str);
                             Thumbnail[j]=new JButton(ic);
                             Thumbnail[j][i].addActionListener(new ThumbnailAction());
                             MainPanel.add(Thumbnail[j][i]);
                        }//inner for
                   }//outer for
                                       //     MainPanel.setVisible(true);
                   heightScrollbar = new JScrollPane(MainPanel);
              heightScrollbar.setName("height");
                   heightScrollbar.setVisible(true);
                   MainPanel.updateUI();
                   heightScrollbar.updateUI();          
              }catch(Exception e){
                   e.printStackTrace();
                   return heightScrollbar;
         }//ThumbnailGui()
         public void removePanel()
         public void loadimage()
    class ThumbnailAction implements ActionListener
              public void actionPerformed(ActionEvent ae)
                   JButton ThumbnailEvent =(JButton)ae.getSource();          
                   String Series="",Imageno="",FilePath="";
                   vSeriesNo1.removeAllElements();                    
                   for(int count=0;count<1;count++)
                   vImageNo1[count].removeAllElements();
                   LoadedFilenames1[count].removeAllElements();
                                  System.out.println("*******Im under Thumbnial Action Listener");
              for(int j=0;j<vSeriesNo.size();j++)
                        for(int i=0;i<vImageNo[j].size();i++)
                             if(ThumbnailEvent==Thumbnail[j][i])
                                                 //Properties dicomheaderdetails = (Properties)parent.htHeaderData.get(vSeriesNo.elementAt(j)+"+"+i);
                                            try
                                                      FilePath=LoadedFilenames[j].elementAt(i).toString().replace('~','\\');
                                                      System.out.println("File name is :"+FilePath);
                                                      Imageno = vImageNo[j].elementAt(i).toString();
                                                      System.out.println("Thumbnail Image Number is : "+Imageno);                                              
                                                      Series = vSeriesNo.elementAt(j).toString();
                                                      System.out.println("Thumbnail Series Number is : "+Series);                              
                                                 }catch (Exception e)
                                                           e.printStackTrace();
                        }//inner for
                   }//outer for          
              vSeriesNo1.addElement(Series);
              vImageNo1[0].addElement(Imageno);
              LoadedFilenames1[0].addElement(FilePath);
              parent.imageLoader = new ImageLoader(parent,vSeriesNo1,vImageNo1,LoadedFilenames1,false,1);          
         }//class

    If you want to add/remove components from a panel then the code should be something like:
    panel.add( something );
    panel.revalidate();
    panel.repaint();
    If you want to replace an entire panel then you should probably be using a [Card Layout|http://java.sun.com/docs/books/tutorial/uiswing/layout/card.html].

  • Can't delete a file displayed in ListView ("File in use") even after removing it from window.

    I have a ListView displaying a collection of icons. The user can then select different icons (checkboxes) to do things like Copy or Delete.
    Problem is, when I try to delete the actual file from the disk, I get an error telling me the file is "in use" ("vshost.exe", the VS runtime during testing).
    I thought maybe it was because it still appeared in the window and was still in the ImageList, but even after removing it from both locations, I still get the error. My code:
    Dim intCnt As Integer = 0
    Do
    ImageList2.Images.RemoveAt(intIconsChecked(intCnt)) ' Remove from collection.
    lsvCollection.Items.RemoveAt(intIconsChecked(intCnt)) ' Remove from ListView window.
    FileIO.FileSystem.DeleteFile(strIconPath & "\Icon" & Format(intCnt + 1, "00") & ".rsc") ' "+1" b/c Icons start with "01".
    FileIO.FileSystem.DeleteFile(strIconPath & "\Icon" & Format(intCnt + 1, "00") & ".png") ' "In use" Error here.
    ".rsc" deletes just fine, so I know I'm deleting the correct file. Why does VS still think the file is still "in use"?
    Thx

    Mugsy,
    Consider this as food for thought, even if you don't use it.
    If you set it up right then you can control how it works. A reference is a reference and any left behind will cause you grief down the road when you try to delete things.
    As an example, a simple class follows. It does *not* implement IDispose, although it does have a private shared Dispose method in it:
    Public Class MyImages
    Private _bmp As Bitmap
    Private _name As String
    Private _sourceFilePath As String
    Private Sub New(ByVal bmp As Bitmap, _
    ByVal name As String, _
    ByVal filePath As String)
    _bmp = bmp
    _sourceFilePath = filePath.Trim
    _name = name.Trim
    End Sub
    Public ReadOnly Property Bmp As Bitmap
    Get
    Return _bmp
    End Get
    End Property
    Public ReadOnly Property Name As String
    Get
    Return _name
    End Get
    End Property
    Public ReadOnly Property SourceFilePath As String
    Get
    Return _sourceFilePath
    End Get
    End Property
    Public Shared Sub AddNew(ByRef miList As List(Of MyImages), _
    ByVal imageFilePath As String)
    Try
    If miList Is Nothing Then
    Throw New ArgumentNullException("The collection of MyImages cannot be null.")
    ElseIf String.IsNullOrEmpty(imageFilePath) OrElse imageFilePath.Trim = "" Then
    Throw New ArgumentException("The file path of the image cannot be null or empty.")
    ElseIf Not My.Computer.FileSystem.FileExists(imageFilePath) Then
    Throw New IO.FileNotFoundException("The file path of the image could not be located.")
    Else
    ' Should do validation here that the file
    ' is actually an image but I'll not do this
    ' here...
    Dim thisBMP As Bitmap = New Bitmap(imageFilePath)
    miList.Add(New MyImages(thisBMP, GetFileNameWithoutExtension(imageFilePath), imageFilePath))
    End If
    Catch ex As Exception
    Throw
    End Try
    End Sub
    Public Shared Sub AddNew(ByRef miList As List(Of MyImages), _
    ByVal imageFilePath As String, _
    ByVal imageName As String)
    Try
    If miList Is Nothing Then
    Throw New ArgumentNullException("The collection of MyImages cannot be null.")
    ElseIf String.IsNullOrEmpty(imageFilePath) OrElse imageFilePath.Trim = "" Then
    Throw New ArgumentException("The file path of the image cannot be null or empty.")
    ElseIf Not My.Computer.FileSystem.FileExists(imageFilePath) Then
    Throw New IO.FileNotFoundException("The file path of the image could not be located.")
    ElseIf String.IsNullOrEmpty(imageName) OrElse imageName.Trim = "" Then
    Throw New ArgumentException("The name of this image cannot be null or empty.")
    Else
    ' Should do validation here that the file
    ' is actually an image but I'll not do this
    ' here...
    Dim thisBMP As Bitmap = New Bitmap(imageFilePath)
    miList.Add(New MyImages(thisBMP, imageName, imageFilePath))
    End If
    Catch ex As Exception
    Throw
    End Try
    End Sub
    Public Shared Sub Remove(ByRef miList As List(Of MyImages), _
    ByVal imageFilePath As String, _
    Optional ByVal removeFilePathAlso As Boolean = False)
    Try
    If miList Is Nothing Then
    Throw New ArgumentNullException("The collection of MyImages cannot be null.")
    ElseIf String.IsNullOrEmpty(imageFilePath) OrElse imageFilePath.Trim = "" Then
    Throw New ArgumentException("The file path of the image cannot be null or empty.")
    ElseIf Not My.Computer.FileSystem.FileExists(imageFilePath) Then
    Throw New IO.FileNotFoundException("The file path of the image could not be located.")
    Else
    Dim findInstance As System.Collections.Generic.IEnumerable(Of MyImages) = _
    From mi As MyImages In miList _
    Where mi.SourceFilePath = imageFilePath
    If findInstance.Count <> 1 Then
    Throw New ArgumentException("The instance of MyImages specified by the" & vbCrLf & _
    "image file path is not in the collection.")
    Else
    Dispose(findInstance.First)
    If removeFilePathAlso Then
    My.Computer.FileSystem.DeleteFile(findInstance.First.SourceFilePath)
    End If
    miList.Remove(findInstance.First)
    End If
    End If
    Catch ex As Exception
    Throw
    End Try
    End Sub
    Private Shared Sub Dispose(ByVal instance As MyImages)
    If instance IsNot Nothing AndAlso instance._bmp IsNot Nothing Then
    instance._bmp.Dispose()
    instance._bmp = Nothing
    End If
    End Sub
    End Class
    When you look through that, look specifically at the "Remove" method and in particular, look at the order in which things are done. That's the critical part in this.
    I tested it with a simple form:
    Two buttons, a checkbox, and a picturebox. I also copied a small folder full of image files to my desktop since I'll be deleting a file from it. Following is the code for Form1:
    Option Strict On
    Option Explicit On
    Option Infer Off
    Imports System.IO.Path
    Public Class Form1
    Private miList As New List(Of MyImages)
    Private Sub Form1_Load(ByVal sender As System.Object, _
    ByVal e As System.EventArgs) _
    Handles MyBase.Load
    Dim desktop As String = _
    My.Computer.FileSystem.SpecialDirectories.Desktop
    Dim imgFolder As String = _
    Combine(desktop, "Images")
    PictureBox1.BorderStyle = BorderStyle.FixedSingle
    For Each imgFilePath As String In My.Computer.FileSystem.GetFiles(imgFolder)
    MyImages.AddNew(miList, imgFilePath)
    Next
    btn_RemoveFirstImage.Enabled = False
    CheckBox_RemoveSourcePath.Enabled = False
    End Sub
    Private Sub btn_ShowFirstImage_Click(sender As System.Object, _
    e As System.EventArgs) _
    Handles btn_ShowFirstImage.Click
    Try
    If miList.Count >= 1 Then
    With PictureBox1
    .SizeMode = PictureBoxSizeMode.Zoom
    .Image = miList(0).Bmp
    End With
    btn_RemoveFirstImage.Enabled = True
    CheckBox_RemoveSourcePath.Enabled = True
    End If
    Catch ex As Exception
    MessageBox.Show(String.Format("An exception was thrown:{0}{0}{1}", vbCrLf, ex.Message), _
    "Exception", MessageBoxButtons.OK, MessageBoxIcon.Warning)
    End Try
    End Sub
    Private Sub btn_RemoveFirstImage_Click(sender As System.Object, _
    e As System.EventArgs) _
    Handles btn_RemoveFirstImage.Click
    Try
    If miList.Count >= 1 Then
    MyImages.Remove(miList, miList(0).SourceFilePath, CheckBox_RemoveSourcePath.Checked)
    End If
    PictureBox1.Image = Nothing
    btn_RemoveFirstImage.Enabled = True
    CheckBox_RemoveSourcePath.Enabled = True
    Catch ex As Exception
    MessageBox.Show(String.Format("An exception was thrown:{0}{0}{1}", vbCrLf, ex.Message), _
    "Exception", MessageBoxButtons.OK, MessageBoxIcon.Warning)
    End Try
    End Sub
    End Class
    Running it is straightforward:
    Now when I click to show the first one:
    A different image is shown because that first one no longer exists - either in the collection or in the folder.
    Closing/disposing all references is the key and the order matters.
    Something to consider the next time around. :)
    Still lost in code, just at a little higher level.

Maybe you are looking for

  • Error message when connecting to database!

    Hi For this assignment i create a databse with Acces. when i run the following code i get an error message. Dropping indexes & tables ? Could not drop primary key on UserStocks table: [Microsoft][ODBC Microsoft Access Driver] Cannot find table or con

  • IMac G5 crashes during bootup (except safe mode)

    Greetings! I shutdown my iMac G5 for the first time in about a month on Sunday. I started it up last night for the first time since then and I immediately noticed that I didn't get a startup chime - very odd. After displaying the gray screen for abou

  • Custom Item Renderer Issue for List

    Hi, I have a List that uses a custom renderer that contains a combo box and a checkbox. If i define the data provider inline in MXML both the combobox and the checkbox render values correctly. However, if I switch the dataprovider to an AS 3.0 ArrayC

  • Acess "set-cookie" and set later in lookup in UDF?

    Hello Experts, I' have a senario where I need to get a session ID in order to handle a series of web service request. Therefore I have written a UDF in the mapping where the first method (as login message) where I get a login key as payload and the s

  • Help getting .mov off of new 3gs iphone windows

    Is there a way to get the videos u take off of the new iphone on a windows pc. I see lots of post for mac users but non for pc users. Any help please. Is there any good software out there or a workaround. Thank you in advance.