Hi. On a published article, there were downloadable files till some time back. Now when someone clicked on the link, it shows an error. Here is the article: Rename Attachments in Outlook[^] Need help from Admins to sort this out. Som
Som
Hi. On a published article, there were downloadable files till some time back. Now when someone clicked on the link, it shows an error. Here is the article: Rename Attachments in Outlook[^] Need help from Admins to sort this out. Som
Som
I think this should be simple. You need to capture the KeyPreview on dgv, check if there is a cell selected, then if it is the last cell,last row and then add a new column. Then set the selection to the first cell of the new row.
So, where are you from? Delhi/Mumbai/Bangalore? some other city?
naah.. the hardest part is to fight flickering ;) when anything u do in windows doesn't work :D
the easiest possible answer would be f(x,y) = a*x + y where a = Maximum possible value of y + 1
Hey Luc, Is there any Graphics Library available for .Net which does more than what GDI+ does? I mean something that takes care of some advanced functions like layering? I have an interest in printing multiple png images with transparency, being able to drag and drop them. Also, having multiple layers like in Adobe Photoshop? Ofcourse I mean open source/free. Som
Hey, lemme say sorry for not writing in the correct grammar. What i said was:
Som wrote:
Wise men have already spoken. So, no need to answer the question asked about disposing.
and what i meant Wise men have already spoken. So, I do not need to answer the question asked about disposing.
he he he. I was talking about both of you. I do not deny that writing in Paint event is incorrect. I am only saying that it is not necessary and shouldn't be considered as a norm. Thats all. By the way, our so long discussion might be confusing the poor guy who wrote the code for the first time :laugh:
Wise men have already spoken. So, no need to answer the question asked about disposing. Your suggestion is right about doing the paint part in Form.Paint event. However, I don't see anything wrong in doing it in Button_Click for learning purposes. Doing all drawing during paint may become an herculean task. I prefer doing my drawing on a bitmap at different occasions and draw the bitmap during Form.Paint. This imitates double buffering and saves from doing any calculations that may be required in Form.Paint every time the form is painted.
Your code is fine. However the size of the rectangle is too small. It might be possible that the circle is made below the button. My suggestion would be to increase the rectangle size. Apart from that, there is one good habit you should start right away. Dispose the graphics object after you are done with it. This is a major source of memory leak.
I have been using Eazfuscator.NET which is an open source solution for obfuscation. You can visit http://www.foss.kharkov.ua/g1/projects/eazfuscator/dotnet/Default.aspx[^] for this. I have been happy with the results so far. Som
Extend a TabControl. Call it say CustomTabControl. The idea is to remove the tabs. So, you get the functionality you want. There are many articles here on how to have custom tab controls. You basically need to tweak following properties. ItemSize = (0, 1) SizeMode = TabSizeMode.Fixed Appearance = TabAppearance.Buttons
public bool e(int x)
{
if (x <= 2 && x >= 0) return true; //Some values return here
for (int i = 2; i >= x; i++)
if (x % i == 0) return false; //Some values return here
return true; //Anything that is left is returned here
}
This is your first piece of code which works. I have only reformatted it to see the code flow. Here, for every value of x, there is a return path available. Hence this one is a legal code.
public bool e(int i)
{
if (i <= 2 && i >= 0) return true; // if i = 0, 1, 2 return here.
for (int f = 2; f <= i; f++) // if i >2 enter here.
{
if (i % f == 0)
{
return false; // only if i>2, some return here
}
else
{
return true; // only if i>2, BALANCE return here
}
}
//What happens to values of i<0 ?
}
As correctly pointed out by the compiler, not all paths return the value. Hence the code syntax is incorrect. I suggest you think a bit more logically to see the difference in two cases. I also suggest to take a break from coding. it happens sometimes when you have done coding for a very long time. trust me. Som
What are you trying to do here buddy? Are you trying to prove that your inefficient coding techniques are right and C# language is incorrect? Every programming language has a syntax. You need to follow them in order to use it. You need to ask these questions yourself and tell us why one code works and why the other doesn't. When you can find the reason yourself, you will be able to write the correct code from next time onwards. All the best.
because the method returns a value only when i<=2. what if i>2? think how the code will proceed? where does the code get return statement if i>2?
IMPORTANT: Use 'pre' tags for your code. without those tags, the code is totally unreadable. Also, do preview your post. There are many errors in your post. Now, the second code works because it considers all possible values of x. if it is less than 1, it returns false. otherwise, for all other values, it can be either true or false. try changing the code to x<=0
While the other both answers are correct, I only want to mention the reasoning behind it. The code considers all possible exits in a program and if it doesn't achieve the desired result in it, it raises an error. In your for loop, you have trapped all possible outcomes. So, whatever the number f be, there will be an answer. But what happens when the code doesn't enter the loop? what if i = 1? Hence, there should be one more return statement after the loop ends.
Alex Manolescu wrote:
I'll bring back news!
All the best.
Usually, it makes more sense to create a line control. or use VisualBasic PowerPack to add a LineShape. Or the best of all, draw all on a canvas. What OriginalGriff suggested will work but will have too much flickering. Also, the line will only be drawn when you have finished moving the control. Atleast my experience has been troublesome so far.
I see the point your Lecturer is trying to convey. You are at a learning stage. Hence there will always be possibilities that the code you write will need to be improved/modified/tweaked. If this is the final code piece and there cannot be any more changes to be made, this code is fine. However if there is a possibility that someone else may be using your code (as in the case of Open Source/ or in a Production Environment), this code may cause misunderstandings. Consider this, what happens if you join a company and are given this piece of code and are asked to make some changes. How comfortable would you be? (You understand this code. But any other such code example?)
:) Cool.