I use a singleton when i shoud be able to access the class anywhere in my project and if the class shoud remember some data (that can change)
I use a static class when i just have methods that calculate or do something and don't have to 'remember' data
I guess this is the right approach, correct me if i'm wrong :)...
User Profile
Collapse
-
this piece of code is executed in the contructor of the UC
if i leave it i can add the UC to the form
and in the constructor of the form i then call the method which caused the error
very strange is this some kind of bug?...Leave a comment:
-
strange NullReferenceException
I have a singleton class DataAccess containing al methods that interact with the DB
This works just fine but when i use this singleton class in a usercomponent and then add my usercomponent to a form, i get an alertbox with a nullreference exception
in my user component
Code:dgvArtikels.DataSource = DataAccess.getInstance().getArtikels().Tables[0];
... -
Draw rectangle on picturebox (moving with mouse)
Hello
I've written some code to draw a rectangle on a picture box when the user moves the mouse.
(the previous rectangle is cleared)
This works fine but the very first rectangle is not removed from the screen.
here is my code
[PHP]
private Rectangle r = new Rectangle(new Point(0,0), new Size(0,0));
private void pictureBox1_Mou seMove(object sender, MouseEventArgs... -
C# horizontal listview drag drop
Hello :)
I would like to have an horizontal image list where you can drag and drop the images to reorder them
(like slide reorder in powerpoint, but then in an horizontal way)
so i had a look to this article: http://www.codeproject.com/KB/miscct...eordering.aspx
and a set scrollable to false, so that al itemes were arranged horizontaly
but the reordering doesn't work
...
No activity results to display
Show More
Leave a comment: