Interact with components from other forms

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • M1kkelZU
    New Member
    • Feb 2013
    • 80

    Interact with components from other forms

    This may seem a bit dumb, but I've never learnt this at college and I can't find any tutorials or examples.

    what I'm doing is giving the user the choice to show 2 different dates. 1 in yyyy-mm-dd notation and the other in dd-mm-yyyy notation.

    I'm using a second form to do this.
    So from Form1 I have my data in the datagrid and in Form2 I have 2 radio buttons giving the user the choice between Date1 and Date2. So how would I be able to interact with the first form with the radio buttons?
  • vijay6
    New Member
    • Mar 2010
    • 158

    #2
    Hey M1kkelZU, is you invoking 'Form2' from 'Form1'?

    Comment

    • M1kkelZU
      New Member
      • Feb 2013
      • 80

      #3
      What do you mean with Invoking form2 from form1?

      Sorry, I'm still in college so most of this wont make sense to me yet. My professors aren't exactly the best nowadays.

      Comment

      • vijay6
        New Member
        • Mar 2010
        • 158

        #4
        Hey M1kkelZU, you said you're showing two different forms 'Form1' and 'Form2'. Is you taking object for 'Form2' and showing it inside of 'Form1'?

        Comment

        • M1kkelZU
          New Member
          • Feb 2013
          • 80

          #5
          Well What I'm doing is just giving an option to change the view of a column in the datagridview.
          The Datagridview is in Form1 and the options are in Form2.

          Comment

          • vijay6
            New Member
            • Mar 2010
            • 158

            #6
            Hey M1kkelZU, change the Access Modifiers of the 'radio button 1' and 'radio button 2' to public (so that you can access them from outside of 'Form2') inside 'Form2'. And in 'Form1' create the CheckedChanged event for the both radio buttons after taking the object to 'Form2' and before calling the 'Show' method. And inside the CheckedChanged event of 'radio button 1' check 'radio button 1' is checked or not. If checked means do the necessary changes to your data-grid-view. Do the same thing also for 'radio button 2'.

            Comment

            • M1kkelZU
              New Member
              • Feb 2013
              • 80

              #7
              Well I have to interact with the datagridview through the radio buttons, so how would I change the accessmodifier of the data grid?

              Comment

              • vijay6
                New Member
                • Mar 2010
                • 158

                #8
                Hey M1kkelZU, for your question "So from Form1 I have my data in the datagrid and in Form2 I have 2 radio buttons giving the user the choice between Date1 and Date2. So how would I be able to interact with the first form with the radio buttons?" there is no need to change the access modifier of the data-grid-view.

                Comment

                • M1kkelZU
                  New Member
                  • Feb 2013
                  • 80

                  #9
                  Ah ok, so if I change the modifier from private to public I should be able to change the way a column is shown. If thats too much work I'll just add the radio buttons to the original form to save time.

                  Comment

                  • vijay6
                    New Member
                    • Mar 2010
                    • 158

                    #10
                    If thats too much work I'll just add the radio buttons to the original form to save time.
                    Hey M1kkelZU, Your wish.

                    Comment

                    • M1kkelZU
                      New Member
                      • Feb 2013
                      • 80

                      #11
                      I do want to try and get this working as it will make the main form look less cluttered. Thanks for the help vijay6 :)

                      Comment

                      Working...