-8

Possible Duplicate:
Passing variables from main form to input form
Passing data between forms

How would i pass the result of a boolean function from a main form? It's basically to check whether the user has authority to edit anything in the program? I basically want to check that boolean on any event that deals with editing. Any ideas? Thanks.

Community
  • 1
  • 1
jwill22
  • 61
  • 4
  • 15

2 Answers2

1

Create a property (or method) on FormOptions, say GetMyResult:

 using (FormOptions formOptions = new FormOptions())
{
    formOptions.ShowDialog();

    string result = formOptions.GetMyResult;

    // do what ever with result...
}
Rutger Kappers
  • 366
  • 1
  • 3
  • 11
  • Thanks for actually helping sir unlike some of the others – jwill22 Jul 03 '12 at 14:43
  • @jwill22 the reason you've received such an overwhelmingly negative response is that your question has already been answered multiple times. Didn't you try to search on StackOverflow before asking? Were the other answers unhelpful? – Adam Jul 03 '12 at 14:50
  • Yes but the answers are not what I wanted. – jwill22 Jul 03 '12 at 14:53
  • You can use only DialogResult property with values DialogResult.OK or any other value – Save Jul 03 '12 at 15:36
1

It can be done in many ways,

  1. Write a Contructor with bool argument. Pass that argument and decide.

  2. Create a bool property which can be accessible from calling method.

Rajesh Subramanian
  • 6,400
  • 5
  • 29
  • 42