How can i change the expand level of nodes in treeView1 according to numericupdown value change ?

I have this method:
void ExpandToLevel(TreeNodeCollection nodes, int level)
if (level > 0)
foreach (TreeNode node in nodes)
node.Expand();
ExpandToLevel(node.Nodes, level - 1);
I added now a new method:
void CollapseToLevel(TreeNodeCollection nodes, int level)
if (level > 0)
foreach (TreeNode node in nodes)
node.Collapse();
CollapseToLevel(node.Nodes, level - 1);
Then in the numericupdown changed value event i did:
decimal oldValue;
private void numericUpDown1_ValueChanged(object sender, EventArgs e)
if (numericUpDown1.Value > oldValue)
ExpandToLevel(treeView1.Nodes, (int)numericUpDown1.Value);
else
CollapseToLevel(treeView1.Nodes, (int)numericUpDown1.Value);
oldValue = numericUpDown1.Value;
When i expand change the numericupdown value up it's expand it fine level by level. But when i collapse it back when changing the numericupdown value back down if i was at value 4 and now changed to value 3 all the nodes collapsed back to root.
I want it to collapse only by one level from 4 to 3 to 2 to 1 when the vlaue is 0 then collapse back to root.
The collapse is not working good.

Hi,
You don't need to loop from the start to collapse it.
Just issue the collapse on the current node; if its not collapsible then nothing will happen.
treeView1.SelectedNode.Collapse();
Happy coding.
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

Similar Messages

  • How can I check the ink level in my Hp printer j4580

    I am so frustated, and upset with my hp printer, the only thing I waant to is how can I check the ink level in my Hp printer j4580, sound simple, well I have spend hours traying, and  I still don't know how to do it. This is ridicule

    Hello manguelo,
    Welcome to the HP Forums.
    I see that you are attempting to check the ink levels on the printer.
    Here is a link that will take you to a document that gives detailed instructions on Checking Ink Levels for HP Officejet J4500 and J4600 All-in-One Printer Series.
    Please feel free to write me back if you have any other questions or concerns.
    Cheers,  
    Click the “Kudos Thumbs Up" at the bottom of this post to say “Thanks” for helping!
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    W a t e r b o y 71
    I work on behalf of HP

  • How can I determine the liquid level in a bottle (LabView Vision)?

    How can I determine the liquid level in a bottle (LabView Vision)? Does anybody have an example code? The task is, that if liqid level is between two predetermined level, the program writes, that it is correct else it writes incorrect. Thank you.

    here is a little play with your bad picture:
    used only the small field of interest (here a guess) ,
    used only the red channel ( takes out most of the light reflection)
    grey scale, 3x(blurr, median filter) , played with  contrast -gamma - saturation
    now you need to add the edge detection and some sort of scale.
    Greetings from Germany
    Henrik
    LV since v3.1
    “ground” is a convenient fantasy
    '˙˙˙˙uıɐƃɐ lɐıp puɐ °06 ǝuoɥd ɹnoʎ uɹnʇ ǝsɐǝld 'ʎɹɐuıƃɐɯı sı pǝlɐıp ǝʌɐɥ noʎ ɹǝqɯnu ǝɥʇ'

  • How to get only the first level of nodes for a subform?

    How can we get only the first level of nodes of a subform?
    For ex:
    Form1
         SubForm1
              Text1
              Text2
              RadioButton1
         SubForm2
              Text1
              Text2
              RadioButton1
         SubForm3
              Text1
              Text2
                   SubForm31
                        RadioButton1
    In this heirarchy if we give Form1.nodes will refer to all nodes under the Form1 (SubForm1,Test1,Text2,RadioButton1,SubForm2,...SubForm31, RadioButton1 etc..)
    But is there any way that we can access only the first level of nodes of Form1 ie can we get only (SubForm1,SubForm2,SubForm3) for Form1 in any Way..?
    Thanks.

    Two ways .....
    1. Use Javascript E4X instead ...there are nice functions for getting children of parents.
    2. Cycle through all of the form1.nodes and look for objects that have a className of "subform". For loops are useful for this task.
    Make sense?
    Paul

  • How can I display the Process Level by Phase in a Grid or Data Form?

    We are using phased submissions. I can see that changing the display options on a grid will show the current Process Level for the processing unit defined by the POV. But how can we break this down by phase?

    Try what is suggested in Page 243 of the User's Guide:
    You can display multiple submission phases, view review level status, and perform process management actions for multiple phases in Process Control.
    If you select Single period view, you can select one or more submission phases to include in the columns. For each column, you can display one or more of these options: Calculation Status, Journals, Review Level, Pass/Fail, and Validation. If selected, Review Level, Pass/Fail, and Validation are included for each phase. Since Calculation Status and Journals apply to the entire processing unit, they are displayed only once regardless of how many phases are selected. If you select All period view, you can select Calculation Status or Review Level information for the columns. If you select Review Level information, you should select one submission phase
    for display. When you select All periods, or Tree for the display, the filter option is unavailable.
    Here is the options:
    !http://0ue0ag.blu.livefilestore.com/y1pceBZ2nCvU8wYKj38bzK_O3B8eXo5XwfxwTkVeMdPu1fi6lHT_DcYrxlptGHYDm6N4lA0H2YMnWx4qtcOe4ttmM-Em-fheg5P/Phase%20Submission.jpg!
    And the Result:
    !http://0ue0ag.blu.livefilestore.com/y1pWfMkCFrViEuCRyAHWCphl7y0gZBAK3UY1f2ECi1kme3_xP2FQjyG5f4TC7QHwoHPxBSb0GTKpyU6TXMSp9P5wR5LbJeYl5eu/Phase%20Submission2.jpg!

  • How can i adjust the sound level customized for each browser tab?

    Hi,
    I'm kinda a new mac user. I want to know how i can adjust the sound level specifically for each browser tab or application the way you could do in windows.
    Thanks.

    Volume Mixer feature  that Windows has, is not available in OS X.
    Best.

  • How can i increase the sound levels?

    the volume on all of my tunes seems too low,  and changing the loudness feature under settings doesn't help. what can i do?

    Hi,
    One thing can help a little is the following.  Right click the speaker icon in the Taskbar and select 'Playback Devices'.  Left click the default device once to highlight it ( it's usually 'speakers & headphones' ) then click the Properties button.  Click the Enhancements tab and put a tick in the box next to 'Loudness Equalization'.  Click Apply to save the change and then click OK in all remaining windows and see if this has helped at all.
    Regards,
    DP-K
    ****Click the White thumb to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    ****I don't work for HP****
    Microsoft MVP - Windows Experience

  • How can one determine the nice level of running processes?

    Renice is a wonderful and easy way to change CPU priority of processes. (If you are working in Final Cut Pro while rendering in After Effects in the background, you can set After Effects to only use leftover computing power that you are not needing in Final Cut Pro, thus not hanging up your work in Final Cut) Google renice to learn more). However.... how do you determine what the current nice levels of processes are?
    Thank you, somebody!

    Thank you! A total mystery language to me ("comm,nice"?) but works just dandy!

  • How can I get the battery level of a connected Bluetooth device on my iPhone 4S?

    My Bluetooth device is the Merkury Hexagon Bluetooth speaker, I want to know how to get the its battery level, In the manual, it says there: "Speaker battery indicator will show right on your media device (iOS support only)
    Additional details:
    - I have the latest iOS
    - Not jailbroken
    - The speaker doesn't have a "battery indicator" on it

    this is not a build in part of any bluetooth profiles so to get that feature one needs third party software from the maker of the bluetooth device installed on the device in question
    so maybe you should look for apps made for mercury hexagon in app store?

  • How can I raise the audio level of just a PORTION of a clip (not the whole thing)?

    Would like to raise the level of one part of my project but NOT the other. This only seems to allow me to raise the entire project, but not individual sections. Earlier versions of iMovie had the ability to crossfade several audio tracks, etc., but this 'new and improved' one doesn't. Am I missing something?
    Have tried separating the audio, but that doesn't help.
    Thanks,
    Cameron

    Cameron,
    Have a look at this article:
    http://docs.info.apple.com/article.html?path=iMovie/9.0/en/mov3b0fb5f2.html
    You can adjust only a portion of the audio of a clip without further splitting it.
    Matt

  • How can I reset the background color of a JPanel to it's default value?

    I have some JPanels that I set their background color to white when I add some objects in them. After some operations the objects are removed and I'd like to reset the background color back to it's default gray. Any suggestions on how to do this? Thanks.

    I took a guess and I figured it out. Just set the background color to null.
    JPanel panel = new JPanel();
    panel.setBackground(Color.white);       //Set Panel to White
    Operations......
    panel.setBackground(null);                 //Reset Panel Color to Default Gray

  • My ipad was stolen last night and how can i disable the device?

    my Ipad was stolen last night and how can i disable the device?

    Report to police along with serial number. Change all your passwords.
    These links may be helpful.
    How to Track and Report Stolen iPad
    http://www.ipadastic.com/tutorials/how-to-track-and-report-stolen-ipad
    Reporting a lost or stolen Apple product
    http://support.apple.com/kb/ht2526
    Report Stolen iPad Tips and iPad Theft Prevention
    http://www.stolen-property.com/report-stolen-ipad.php
    How to recover a lost or stolen iPad
    http://ipadhelp.com/ipad-help/how-to-recover-a-lost-or-stolen-ipad/
    How to Find a Stolen iPad
    http://www.ehow.com/how_7586429_stolen-ipad.html
    Apple Product Lost or Stolen
    http://sites.google.com/site/appleclubfhs/support/advice-and-articles/lost-or-st olen
    Oops! iForgot My New iPad On the Plane; Now What?
    http://online.wsj.com/article/SB10001424052702303459004577362194012634000.html
    If you don't know your lost/stolen iPad's serial number, use the instructions below. The S/N is also on the iPad's box.
    How to Find Your iPad Serial Number
    http://www.ipadastic.com/tutorials/how-to-find-your-ipad-serial-number
     Cheers, Tom

  • Can we control the top level navigation in portal from a java application

    Hello,
    I am having a scenario where User logged in to portal and assigned with 2 roles (HOME , ISA(Java application)). When user opened a form in ISA (Java application) and tried to enter the data in form and moved to another tab (e.g. HOME) in top level navigation.
    When user come back to ISA (Java application) TAB , we show the page where he left earlier. I would like to know if user click any other TAB in top level navigation (Role assigned to him) while working on a page in ISA(Java application) is there any way we can catch that event before he leaves from ISA (Java application JSP page) to other TAB?
    How can we control the top level navigation events in the portal from a java application .Since Top level navigation is seperate par file.
    Thanks,
    RN

    Dear Rajesh,
    Top Level and detailed navigation values comes with iteration in the respective par file.
    Please check the par file and based on the value (i.e tab name) selected, you can write your code.
    Best Regards
    Arun Jaiswal

  • Can't see the record levels

    Hi All,
    Brand new newbie here. I'm sure this question has been answered here but I'm not even sure how to search here for the answer.
    I have Presonus Firebox. I was following the GB help video to record voice. I plugged my microphone into the Presonus Mic/Instrument 1 channel. Chose Mono 1 (Presonus Firebox) from the Input Source. I couldn't see any record levels on the track but tried recording anyway. GB actually recorded the voice since I could play it back and hear it. Also, if I look at the track its just a flat line.
    How can I see the input levels on the track and see the the wave shapes on the track?
    Thanks in advance for your help.
    The Fudd

    OK. Got it figured out. Looks like I didn't have the volume up high enough on the Firebox to register either on the UV meter on the track or to see the wave profile when recording.

  • How can I obtain the primary key of a table for an entity relation?

    hello everybody
    I am doing a consultation to a table in my data base, good this table has alone two fields, the first one is the code or pk and the second one is the description, to be presisos they are names of city and code.
    From the beginning!!: This method this one in another class that is a Dialog that is going to call to the class SelecPlace ();
      SelecPlace sl = new SelecPlace();
    public void capturarLugar(){  //  Simple void method in the mentioned class
            String place = txtProcedencia.getText() ;  //  a JTextField
            sl.executeStatement(place) ;                  
        }ok, now we see part of the code of the class SelectPlace
    public class SelecPlace extends AbstractTableModel{
        Connection con = null;
        Statement sentencia = null ;
        ResultSet rs = null;
        ResultSetMetaData rsmd = null ;
        String[] nameColum = {} ;
        Vector datos = new Vector() ;
        public SelecPlace() { }
        public void executeStatement(String query){
          try{
             con = DBManager.getConnection() ;
             sentencia = con.createStatement(rs.TYPE_SCROLL_INSENSITIVE,
                                                                          rs.CONCUR_UPDATABLE) ;
             String sql = "select * from Place where descripcion like %"+query+"%'";
              rs = sentencia.executeQuery(sql) ;
              rsmd = rs.getMetaData();
              int nroColumnas = rsmd.getColumnCount() ;
              nameColum = new String[nroColumnas] ;
              //obtengo los nombres de columnas en cache
               for(int colum = 0; colum < nroColumnas; columna++){
                    nameColum[colum] = rsmd.getColumnLabel(columna + 1) ;
               datos = new Vector();
                while(rs.next()){
                    Vector newRow = new Vector();
                    for(int i = 0; i < getColumnCount(); i++){
                    newRow.addElement(rs.getObject("place_ID"));
                    newRow.addElement(rs.getObject("description"));
                    datos.addElement(nuevaFila);
                fireTableChanged(null);
            }catch(SQLException e){
                System.err.println(e);
                e.printStackTrace(System.err);
                System.out.println("error in statement");
            }catch(ClassNotFoundException cnfe){
                System.err.println(cnfe);
        }Ok, this code me works and I obtain in this case the field description of the table Place
    Now my question is, how can I obtain the primary field of my table?
    I need this value of this field that in the base of information in a bigint, and to take it to the first class before mentioned, for that I am working with a data base related

    Certain duffymo and everyone!!, good I give you my scheme:
    And generalizing my question, I want to obtain the value of the primary key of a table in the database, I obtain more values of the same row, but I need the primary key, and you see one with the primary key I want to turn a Long and it to insert with code java in foreign clave in another table of the database
    Good of this form I believe that it would not be breaking the integrity relacional of the tables

Maybe you are looking for

  • Yamaha multimedia speakers no longer recognized in speaker output screen. Any suggestions?

    Anyone got any suggestions why my Yamaha speakers won't work with my new iMac? Did an update and they are no longer appearing in the drop down box for output. Internal speakers are my only option. Anyone have any clue?

  • AUTOMATIC CREATION OF REWORK ORDER

    Hi Could any solve my problem? Basically i am working in pipe manufacturing unit where we follow discrete manufacturing. I have some pipes that been rejected from certain operation and sent for reworking.Now, i want that "A rework order should be cre

  • New ipad apps wont open, wifi wont work, iOS 5.1

    Hello all, I am having serious issues with my 'new ipad'. Since plugging and syncing to my laptop PC some issues have arrised. I am running iOS 5.1. The airport icon in the top left displays bars, so I would assume it is connected via wifi to my rout

  • Save a numbers spreadsheet as a simple text document?

    How do you save a numbers spreadsheet as a simple text document? I can't seem to find this option anywhere. Simply renaming the extension also seems to maintain rich text.

  • Leopard Server Time Machine Questions

    We've been running Time Machine to backup client data for about 20 users for a number of months. We've set this up with Time Machine saving to a 750GB RAID 1 external drive mounted as a share point. Each user has a maximum disk quota on the share poi