How to use if statement in user control with picBox? [closed]What is the correct way to create a single-instance WPF application?How do I enumerate an enum in C#?Cross-thread operation not valid: Control accessed from a thread other than the thread it was created onWPF User Control ParentHow do I make a textbox that only accepts numbers?How do I generate a random int number?How do I exit a WPF application programmatically?How can I return an empty IEnumerable?If a folder does not exist, create itWhy not inherit from List<T>?

How could empty set be unique if it could be vacuously false

Second 100 amp breaker inside existing 200 amp residential panel for new detached garage

What constitutes a syllable?

Mathematically modelling RC circuit with a linear input

Should I include an appendix for inessential, yet related worldbuilding to my story?

Helping ease my back pain by studying 13 hours everyday , even weekends

"Correct me if I'm wrong"

What is the most suitable position for a bishop here?

Find All Possible Unique Combinations of Letters in a Word

Is declining an undergraduate award which causes me discomfort appropriate?

What mathematical theory is required for high frequency trading?

What are the current battlegrounds for people’s “rights” in the UK?

Does a proton have a binding energy?

Is there any proof that high saturation and contrast makes a picture more appealing in social media?

Too early in the morning to have SODA?

Definition of 'vrit'

What is the highest voltage from the power supply a Raspberry Pi 3 B can handle without getting damaged?

Greeting with "Ho"

Non-misogynistic way to say “asshole”?

Intuition for the role of diffeomorphisms

What does it cost to buy a tavern?

Extending prime numbers digit by digit while retaining primality

Counterfeit checks were created for my account. How does this type of fraud work?

Cut the gold chain



How to use if statement in user control with picBox? [closed]


What is the correct way to create a single-instance WPF application?How do I enumerate an enum in C#?Cross-thread operation not valid: Control accessed from a thread other than the thread it was created onWPF User Control ParentHow do I make a textbox that only accepts numbers?How do I generate a random int number?How do I exit a WPF application programmatically?How can I return an empty IEnumerable?If a folder does not exist, create itWhy not inherit from List<T>?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I've created a user control with picture box on it and I just want to know how to check if the picture box is Empty or not. I tried to use If statement but PicBox doesn't exist in (statements). How to solve this guys?










share|improve this question













closed as off-topic by Jon Skeet, Stephan Bauer, Stefan Becker, JumpingJezza, greg-449 Mar 25 at 7:59


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Reproducible Example." – Jon Skeet, Stephan Bauer, Stefan Becker, JumpingJezza, greg-449
If this question can be reworded to fit the rules in the help center, please edit the question.











  • 1





    Are you using WPF? Please give some more information about your system, and the code you have tried.

    – Luchspeter
    Mar 25 at 7:11






  • 4





    Welcome to Stack Overflow. Unfortunately it's very hard to help without seeing your code. My guess is that you're either using the wrong variable name, or you've declared it as a local variable within a method or constructor. But we can't really tell without seeing your code. Please provide a minimal reproducible example.

    – Jon Skeet
    Mar 25 at 7:11

















1















I've created a user control with picture box on it and I just want to know how to check if the picture box is Empty or not. I tried to use If statement but PicBox doesn't exist in (statements). How to solve this guys?










share|improve this question













closed as off-topic by Jon Skeet, Stephan Bauer, Stefan Becker, JumpingJezza, greg-449 Mar 25 at 7:59


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Reproducible Example." – Jon Skeet, Stephan Bauer, Stefan Becker, JumpingJezza, greg-449
If this question can be reworded to fit the rules in the help center, please edit the question.











  • 1





    Are you using WPF? Please give some more information about your system, and the code you have tried.

    – Luchspeter
    Mar 25 at 7:11






  • 4





    Welcome to Stack Overflow. Unfortunately it's very hard to help without seeing your code. My guess is that you're either using the wrong variable name, or you've declared it as a local variable within a method or constructor. But we can't really tell without seeing your code. Please provide a minimal reproducible example.

    – Jon Skeet
    Mar 25 at 7:11













1












1








1








I've created a user control with picture box on it and I just want to know how to check if the picture box is Empty or not. I tried to use If statement but PicBox doesn't exist in (statements). How to solve this guys?










share|improve this question














I've created a user control with picture box on it and I just want to know how to check if the picture box is Empty or not. I tried to use If statement but PicBox doesn't exist in (statements). How to solve this guys?







c#






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 25 at 7:10









BassamTFakiraBassamTFakira

92




92




closed as off-topic by Jon Skeet, Stephan Bauer, Stefan Becker, JumpingJezza, greg-449 Mar 25 at 7:59


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Reproducible Example." – Jon Skeet, Stephan Bauer, Stefan Becker, JumpingJezza, greg-449
If this question can be reworded to fit the rules in the help center, please edit the question.







closed as off-topic by Jon Skeet, Stephan Bauer, Stefan Becker, JumpingJezza, greg-449 Mar 25 at 7:59


This question appears to be off-topic. The users who voted to close gave this specific reason:


  • "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error and the shortest code necessary to reproduce it in the question itself. Questions without a clear problem statement are not useful to other readers. See: How to create a Minimal, Reproducible Example." – Jon Skeet, Stephan Bauer, Stefan Becker, JumpingJezza, greg-449
If this question can be reworded to fit the rules in the help center, please edit the question.







  • 1





    Are you using WPF? Please give some more information about your system, and the code you have tried.

    – Luchspeter
    Mar 25 at 7:11






  • 4





    Welcome to Stack Overflow. Unfortunately it's very hard to help without seeing your code. My guess is that you're either using the wrong variable name, or you've declared it as a local variable within a method or constructor. But we can't really tell without seeing your code. Please provide a minimal reproducible example.

    – Jon Skeet
    Mar 25 at 7:11












  • 1





    Are you using WPF? Please give some more information about your system, and the code you have tried.

    – Luchspeter
    Mar 25 at 7:11






  • 4





    Welcome to Stack Overflow. Unfortunately it's very hard to help without seeing your code. My guess is that you're either using the wrong variable name, or you've declared it as a local variable within a method or constructor. But we can't really tell without seeing your code. Please provide a minimal reproducible example.

    – Jon Skeet
    Mar 25 at 7:11







1




1





Are you using WPF? Please give some more information about your system, and the code you have tried.

– Luchspeter
Mar 25 at 7:11





Are you using WPF? Please give some more information about your system, and the code you have tried.

– Luchspeter
Mar 25 at 7:11




4




4





Welcome to Stack Overflow. Unfortunately it's very hard to help without seeing your code. My guess is that you're either using the wrong variable name, or you've declared it as a local variable within a method or constructor. But we can't really tell without seeing your code. Please provide a minimal reproducible example.

– Jon Skeet
Mar 25 at 7:11





Welcome to Stack Overflow. Unfortunately it's very hard to help without seeing your code. My guess is that you're either using the wrong variable name, or you've declared it as a local variable within a method or constructor. But we can't really tell without seeing your code. Please provide a minimal reproducible example.

– Jon Skeet
Mar 25 at 7:11












1 Answer
1






active

oldest

votes


















0














The PictureBox is (like any other control of your form) a member that's not publicly accessible. Hence an access like this won't work:



public class SomeOtherContext

public void Foo()

var form = new FormWithPictureBox();
if (form.pictureBox1.Image != null) // this won't work






What you'll need to do is to generate a public possibility for users of your form to check for a set image. You can e.g. do so by creating a property that's sole purpose is to expose this info:



public class FormWithPictureBox : Form

public bool IsImageSet

get

// the picturebox is accessible from within the form itself
return pictureBox1.Image != null;




public class SomeOtherContext

public void Foo()

var form = new FormWithPictureBox();
if (form.IsImageSet) // use the new property









share|improve this answer





























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    The PictureBox is (like any other control of your form) a member that's not publicly accessible. Hence an access like this won't work:



    public class SomeOtherContext

    public void Foo()

    var form = new FormWithPictureBox();
    if (form.pictureBox1.Image != null) // this won't work






    What you'll need to do is to generate a public possibility for users of your form to check for a set image. You can e.g. do so by creating a property that's sole purpose is to expose this info:



    public class FormWithPictureBox : Form

    public bool IsImageSet

    get

    // the picturebox is accessible from within the form itself
    return pictureBox1.Image != null;




    public class SomeOtherContext

    public void Foo()

    var form = new FormWithPictureBox();
    if (form.IsImageSet) // use the new property









    share|improve this answer



























      0














      The PictureBox is (like any other control of your form) a member that's not publicly accessible. Hence an access like this won't work:



      public class SomeOtherContext

      public void Foo()

      var form = new FormWithPictureBox();
      if (form.pictureBox1.Image != null) // this won't work






      What you'll need to do is to generate a public possibility for users of your form to check for a set image. You can e.g. do so by creating a property that's sole purpose is to expose this info:



      public class FormWithPictureBox : Form

      public bool IsImageSet

      get

      // the picturebox is accessible from within the form itself
      return pictureBox1.Image != null;




      public class SomeOtherContext

      public void Foo()

      var form = new FormWithPictureBox();
      if (form.IsImageSet) // use the new property









      share|improve this answer

























        0












        0








        0







        The PictureBox is (like any other control of your form) a member that's not publicly accessible. Hence an access like this won't work:



        public class SomeOtherContext

        public void Foo()

        var form = new FormWithPictureBox();
        if (form.pictureBox1.Image != null) // this won't work






        What you'll need to do is to generate a public possibility for users of your form to check for a set image. You can e.g. do so by creating a property that's sole purpose is to expose this info:



        public class FormWithPictureBox : Form

        public bool IsImageSet

        get

        // the picturebox is accessible from within the form itself
        return pictureBox1.Image != null;




        public class SomeOtherContext

        public void Foo()

        var form = new FormWithPictureBox();
        if (form.IsImageSet) // use the new property









        share|improve this answer













        The PictureBox is (like any other control of your form) a member that's not publicly accessible. Hence an access like this won't work:



        public class SomeOtherContext

        public void Foo()

        var form = new FormWithPictureBox();
        if (form.pictureBox1.Image != null) // this won't work






        What you'll need to do is to generate a public possibility for users of your form to check for a set image. You can e.g. do so by creating a property that's sole purpose is to expose this info:



        public class FormWithPictureBox : Form

        public bool IsImageSet

        get

        // the picturebox is accessible from within the form itself
        return pictureBox1.Image != null;




        public class SomeOtherContext

        public void Foo()

        var form = new FormWithPictureBox();
        if (form.IsImageSet) // use the new property










        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 25 at 7:26









        khlrkhlr

        3,84832132




        3,84832132















            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript