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;
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#
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
add a comment |
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#
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
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
add a comment |
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#
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#
c#
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
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
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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
add a comment |
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
add a comment |
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
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
answered Mar 25 at 7:26
khlrkhlr
3,84832132
3,84832132
add a comment |
add a comment |
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