CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 28 of 28

Thread: [RESOLVED] iteration from the database

  1. #16
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,539

    Re: [RESOLVED] iteration from the database

    Code:
     
     private void linkUser_Click(object sender, EventArgs e)
            {
                     if(circumstancePanel.Controls!=null){
                         
                          for (int i = this.Controls.Count - 1; i >= 0; i--){
                               Control c = this.Controls[i];
                                // now we check if the control is a checkbox
                               if (c.GetType() == typeof(CheckBox) {
                                   ((CheckBox)c).Checked = true;
                               }
                         }
                    }
    Hope that helps
    Last edited by JonnyPoet; March 13th, 2012 at 10:40 AM.
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  2. #17
    Join Date
    Feb 2012
    Posts
    46

    Re: [RESOLVED] iteration from the database

    I am on it now. Heartily say thanks for your good contributions.

  3. #18
    Join Date
    Feb 2012
    Posts
    46

    Re: [RESOLVED] iteration from the database

    Code:
    int counter = 0;
               Control control = new Control();
                    if(rolePanel.Controls !=null){
                       if(control.GetType()==typeof(CheckBox)){
                           if(((CheckBox)control).Checked==true){
    
    //Not the right code
                               foreach(((CheckBox)control).Checked in rolePanel.Controls.Count){
                               
                               }
                                
                            }
                        
                        }
                    }
                }
    Thanks for your help. This lines of code given me is well explanatory. What i want to achieve is to count the number of selected or checked checkbox(es). How do I get it?

  4. #19
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,539

    Re: [RESOLVED] iteration from the database

    Code:
    int counter = 0; define this in the header of the class (panel or form)
    // in the event delegate where you want to count do the following
                  if(rolePanel.Controls !=null){
                      foreach(Control c in rolePanel.Controls){
                          if(c.GetType()==typeof(CheckBox)){
                              if(((CheckBox)c).Checked==true){
                                 this.counter ++;
     
                               }
     
                            }
     
                        }
                    }
    BTW zip the program and add it here so I can have a look to it
    Its much easier then to help you
    Before doing so remove all files in the obj and the bin folder so there is no exe file included to the zip file
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  5. #20
    Join Date
    Feb 2012
    Posts
    46

    Re: [RESOLVED] iteration from the database

    On this project I have
    1. 10 tables in LinksApplication database
    2. 10 forms which could be selected from the combobox on LinkUser form
    3. Each 10 forms can insert, update, delete from the database tables that bears their name
    4. 3 forms that has 10 panels each: LinkUser, CurrentUser, AllUser to display iterated database table items based on what they are to do

    The one I am working on now is LinkUser interface which has 10 panels, 3 buttons-linkUser, allUser, currentUser
    This is what I want to achieve:
    Each panel gets the values from the tables specific to each.
    It assigns radiobutton to value in the Person table and display them on personPanel

    It assigns checkbox to value in the other tables and add them to their respective panels.

    This is what I want to do. As i am working on LinkUser form. When a value(radiobutton) is selected on personPanel and some checkboxes are checked on rolePanel, circumstancePanel, problemPanel and the LinkUser button is clicked it should assign the checked checkboxes as it values.

    Now if I open the CurrentUser form that conains the personPanel items from the database table(Person) and click on any of the radiobutton it should automatically display the selected values on respectively on other panels in the CurrentUser form.

    Hope I am much communicating. Thanks.

    I would thank you from the bottom of my heart
    Attached Files Attached Files

  6. #21
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,539

    Re: [RESOLVED] iteration from the database

    You did an error The zip file only contains the dln file nothing else But you should dsend all teh application including fatabase only not including any file located in the bin or object folder,
    Simple delete all stuff in that folders, They will be created automatically when you are compiling the project next time

    All the cs files of the project, the database and resources are needed
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  7. #22
    Join Date
    Feb 2012
    Posts
    46

    Re: [RESOLVED] iteration from the database

    The files are bigger that the forum required so it gives me an error of file too big whenever I want to upload to the forum. Is there any better way I could do it? Thanks. Goodmorinig.

  8. #23
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,539

    Re: [RESOLVED] iteration from the database

    Quote Originally Posted by ken4ward View Post
    The files are bigger that the forum required so it gives me an error of file too big whenever I want to upload to the forum. Is there any better way I could do it? Thanks. Goodmorinig.
    click to my name and write me an email. Sendd the file that way
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  9. #24
    Join Date
    Feb 2012
    Posts
    46

    Re: [RESOLVED] iteration from the database

    Code:
    private void solutionPanel_MouseHover(object sender, EventArgs e)
            {
                Intermediate intermediate = new Intermediate();
                DialogResult dialogues = intermediate.ShowDialog();
                if (e.Equals("solutionPanel"))
                {
                    personPanel.Visible = false;
                }
                else
                {
                    personPanel.Visible = true;
                }
    please I want this if I hover solutionPanel should become invisible and intermediate dialog should show. everything is ok but only the if statement. Thanks. So much appreciate your efforts sir. Words can not well compliment your support.

  10. #25
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,539

    Re: [RESOLVED] iteration from the database

    Code:
    private void solutionPanel_MouseHover(object sender, EventArgs e)
            {
                Intermediate intermediate = new Intermediate();
                DialogResult dialogues = intermediate.ShowDialog();
              // code is waiting until dialog is closed
                if (e.Equals("solutionPanel"))
                {
                    personPanel.Visible = false;
                }
                else
                {
                    personPanel.Visible = true;            }
    This cannot do the job, because after you do the show dialog the eexecution of this command halts until the dialog is closed That way your cisible, invisble will not be executed
    Put the show dialog in the last line of that commands
    Last edited by JonnyPoet; March 15th, 2012 at 11:17 AM.
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  11. #26
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,539

    Re: [RESOLVED] iteration from the database

    Quote Originally Posted by ken4ward View Post
    On this project I have
    1. 10 tables in LinksApplication database
    ....
    The one I am working on now is LinkUser interface which has 10 panels, 3 buttons-linkUser, allUser, currentUser
    This is what I want to achieve:
    Each panel gets the values from the tables specific to each.
    It assigns radiobutton to value in the Person table and display them on personPanel

    ....
    This is what I want to do. As i am working on LinkUser form. When a value(radiobutton) is selected on personPanel and some checkboxes are checked on rolePanel, circumstancePanel, problemPanel and the LinkUser button is clicked it should assign the checked checkboxes as it values.

    Now if I open the CurrentUser form that conains the personPanel items from the database table(Person) and click on any of the radiobutton it should automatically display the selected values on respectively on other panels in the CurrentUser form.
    ...
    The problem is I cannot find any of the code you have already shown here in previous topics in the code you sended me. Even the names of that forms are not existing maybe thhey all are derived from any other form but for eyamole there is no delegate called LinkUser_Click() in this project nor I can find solutionPanel_MouseHover ???
    So please which form are you working on or if thhe project I got is not the actual one then pleease send that one, you really are working on
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

  12. #27
    Join Date
    Feb 2012
    Posts
    46

    Re: [RESOLVED] iteration from the database

    It is still the same, the only thing is that I have changed some names in it. This is the main project. Thanks.

  13. #28
    Join Date
    Mar 2005
    Location
    Vienna, Austria
    Posts
    4,539

    Re: [RESOLVED] iteration from the database

    Quote Originally Posted by ken4ward View Post
    It is still the same, the only thing is that I have changed some names in it. This is the main project. Thanks.
    Maybe, but I cannoz find even one line of code of what you are describing here
    Jonny Poet

    To be Alive is depending on the willingsness to help others and also to permit others to help you. So lets be alive. !
    Using Code Tags makes the difference: Code is easier to read, so its easier to help. Do it like this: [CODE] Put Your Code here [/code]
    If anyone felt he has got help, show it in rating the post.
    Also dont forget to set a post which is fully answered to 'resolved'. For more details look to FAQ's about Forum Usage. BTW I'm using Framework 3.5 and you ?
    My latest articles :
    Creating a Dockable Panel-Controlmanager Using C#, Part 1 | Part 2 | Part 3 | Part 4 | Part 5 | Part 6 | Part 7

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)