c# - Fetch a value of a property of an object in ArrayList - Get link Facebook X Pinterest Email Other Apps - March 15, 2011 I started a ArrayList for Windows Forms in C #. I am adding new objects with some properties of each object in , such as: ArrayList FormFields = new ArrayList (); CDDatabaseFieldDB = newCDDatabaseField (); Db.FieldName = FieldName; // fieldname, the input value received from the Windows Form Db.PageNo = PageNo; // page, description, button command area name is also received like DB. Description = description; Db.ButtonCommand = ButtonCommand; FormFields.Add (DB); Now when I want to check only FieldName of each object in ArrayList (assuming that there are many objects in the code> ArrayList ). How can I do this? I tried: for (int i = 0; i But this is causing the error (in the IDE). I'm new to C # programming, so can someone help me with this ?? Error: Error 21 'object' has no definition for 'field name' and no extension method 'fieldname' does not accept 'first argument' of type 'object' can be found (Do not you remember the Use Director or Assembly Reference?) Array list holds objects It is not normal and is safe. That's why you need to reach your object to your property. Instead, consider using generic collections such as list & lt; T & gt; . varFormFields = new list & lt; CdatabaseField & gt; (); CDDatabaseFieldDB = newCDDatabaseField (); ... formfield.ed (db); Then you can see that all the properties will be visible because now the compiler knows the type of elements and allows you to access your type of members safely in a way. Get link Facebook X Pinterest Email Other Apps Comments Popular posts from this blog mysql - How to enter php data into a html multiple select box - - March 15, 2014 I am working on a page that will create a team. I just want to create a selection box which will list all the users of all the users. After that, the user can select more than one friend (i.e. 5) and can send the request to these 5 people to join the team but I am having problems I did this: Select $ sql = "Select i. *, Join * Connect with M * m.id = i.clique_id where adder_id =: id"; $ Stmt = $ db- & gt; Query ($ sql, array ('id' = & gt; $ _SESSION ['id'])); While ($ record = $ stmt-> fetch ()) {$ surname = $ record ['surname']; } and this: & lt; Select multiple = "true" name = "category" well id = "category" name = "category" category = "" & gt; & Lt; Option value = "& lt ;? php echo $ surname ;? & gt;" & Gt; & Lt ;? Php ek $ nickname; ? & Gt; & Lt; / Options & gt; & Lt; / Select & gt; But only a friend's nickname... Read more java - Can't add JTree to JPanel of a JInternalFrame - - September 15, 2015 There are two panels in my JInternalframe. I want to add TopPanel to Jtree to nominate another. But I can not add Jaitari to the top of the panel. Please help me in this piece of code: DefaultMutableTreeNode root = new DefaultMutableTreeNode ("deck"); DefaultMutableTreeNode Item Clubs = New DefaultMutableTreeNode ("Club"); AddAllCard (itemClubs); Root.add (itemClubs); DefaultMutableTreeNode item = New DefaultMutableTreeNode ("Diamonds"); AddAllCard (itemDiamonds); Root.add (itemDiamonds); DefaultMutableTreeNode Itemspads = New DefaultMutableTreeNode ("Spades"); AddAllCard (itemSpades); Root.add (itemSpades); DefaultMutableTreeNode item increases = new DefaultMutableTreeNode ("heart"); AddAllCard (itemHearts); Root.add (itemHearts); Default Trimodel Tree Model = New DefaultTreeModel (Route); Tree = new jetty (tree modal); ScrollPane = new JScrollPane (tree); // scrollPane.setViewportView (tree); . ScrollPane.getViewport () add (tr... Read more java - How to drag a JavaFX node and detect a drop event outside the JavaFX Windows? - - May 15, 2010 I am implementing a tabkin that can be separated from the JavaFX window. When the tab panel is pulled out of the window where it came from, I have to create a new window and the tab to be placed in that window. I have already applied some methods using drag gestures, drag the tab between the existing window. However, when I'm taking a mouse out of javax sequences, I'm not able to get any mouse events or drag events. Is this something possible? You can listen to a mouse release incident on the appropriate node (like the graphic of the tab). Check the screen coordinates using MouseEvent.getScreenX () and MouseEvent.getScreenY () and see if they are out of the current window. If they do, create a new window, view and tab panel; Remove the tab from the current tab panel and place it in a new location. There is no fundamental example with no frills (for example, a user does not indicate that the dragging is happening), but you should consider this: import Please ... Read more
mysql - How to enter php data into a html multiple select box - - March 15, 2014 I am working on a page that will create a team. I just want to create a selection box which will list all the users of all the users. After that, the user can select more than one friend (i.e. 5) and can send the request to these 5 people to join the team but I am having problems I did this: Select $ sql = "Select i. *, Join * Connect with M * m.id = i.clique_id where adder_id =: id"; $ Stmt = $ db- & gt; Query ($ sql, array ('id' = & gt; $ _SESSION ['id'])); While ($ record = $ stmt-> fetch ()) {$ surname = $ record ['surname']; } and this: & lt; Select multiple = "true" name = "category" well id = "category" name = "category" category = "" & gt; & Lt; Option value = "& lt ;? php echo $ surname ;? & gt;" & Gt; & Lt ;? Php ek $ nickname; ? & Gt; & Lt; / Options & gt; & Lt; / Select & gt; But only a friend's nickname... Read more
java - Can't add JTree to JPanel of a JInternalFrame - - September 15, 2015 There are two panels in my JInternalframe. I want to add TopPanel to Jtree to nominate another. But I can not add Jaitari to the top of the panel. Please help me in this piece of code: DefaultMutableTreeNode root = new DefaultMutableTreeNode ("deck"); DefaultMutableTreeNode Item Clubs = New DefaultMutableTreeNode ("Club"); AddAllCard (itemClubs); Root.add (itemClubs); DefaultMutableTreeNode item = New DefaultMutableTreeNode ("Diamonds"); AddAllCard (itemDiamonds); Root.add (itemDiamonds); DefaultMutableTreeNode Itemspads = New DefaultMutableTreeNode ("Spades"); AddAllCard (itemSpades); Root.add (itemSpades); DefaultMutableTreeNode item increases = new DefaultMutableTreeNode ("heart"); AddAllCard (itemHearts); Root.add (itemHearts); Default Trimodel Tree Model = New DefaultTreeModel (Route); Tree = new jetty (tree modal); ScrollPane = new JScrollPane (tree); // scrollPane.setViewportView (tree); . ScrollPane.getViewport () add (tr... Read more
java - How to drag a JavaFX node and detect a drop event outside the JavaFX Windows? - - May 15, 2010 I am implementing a tabkin that can be separated from the JavaFX window. When the tab panel is pulled out of the window where it came from, I have to create a new window and the tab to be placed in that window. I have already applied some methods using drag gestures, drag the tab between the existing window. However, when I'm taking a mouse out of javax sequences, I'm not able to get any mouse events or drag events. Is this something possible? You can listen to a mouse release incident on the appropriate node (like the graphic of the tab). Check the screen coordinates using MouseEvent.getScreenX () and MouseEvent.getScreenY () and see if they are out of the current window. If they do, create a new window, view and tab panel; Remove the tab from the current tab panel and place it in a new location. There is no fundamental example with no frills (for example, a user does not indicate that the dragging is happening), but you should consider this: import Please ... Read more