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

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현