Click here to Skip to main content
15,918,889 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: Garbage Collection Pin
supercat97-Oct-09 7:44
supercat97-Oct-09 7:44 
GeneralRe: Garbage Collection Pin
KSR817-Oct-09 11:15
KSR817-Oct-09 11:15 
QuestionNCoverExplorer Report & MSBuild Pin
Jammer6-Oct-09 10:48
Jammer6-Oct-09 10:48 
AnswerRe: NCoverExplorer Report & MSBuild [modified] Pin
Ergwun9-Jun-10 21:18
Ergwun9-Jun-10 21:18 
QuestionMemory leak in VB.NET screenshot application Pin
Jordan19826-Oct-09 4:10
Jordan19826-Oct-09 4:10 
AnswerRe: Memory leak in VB.NET screenshot application Pin
Dave Kreskowiak6-Oct-09 4:39
mveDave Kreskowiak6-Oct-09 4:39 
GeneralRe: Memory leak in VB.NET screenshot application Pin
Jordan19826-Oct-09 5:00
Jordan19826-Oct-09 5:00 
AnswerRe: Memory leak in VB.NET screenshot application Pin
Luc Pattyn6-Oct-09 5:39
sitebuilderLuc Pattyn6-Oct-09 5:39 
Hi,

thanks for using PRE tags; there are many problems with your code, such as:

1.
ScreenShot() is called twice; that must be a mistake

2.
there is a lack of Dispose() calls, as Dave already mentioned.
You must dispose of each of the graphics you create, so there must also be a dispose inside the for loop.
And you must dispose of each of the bitmaps you create.

3.

Jordan1982 wrote:
Catch ex As Exception
Return False
End Try


is not acceptable; you should at least log what went wrong, not just ignore it.
And the helpdesk will probably hate you for providing no clue whatsoever:
"MessageBox.Show("Failed to take a screenshot - please report to helpdesk")"

4.


Jordan1982 wrote:
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try


that is better, however ex.ToString() would show more information.

5.

Jordan1982 wrote:
If System.IO.File.Exists(strPath) Then
System.IO.File.Delete(strPath)
End If


No need to test, Delete() does nothing when the file doesn't exist.

6.


Jordan1982 wrote:
Private Sub NotifyIcon1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles NotifyIcon1.DoubleClick
'The click method for the systray icon
Main()
End Sub


Bad choice of a method name; Main() normally is what runs first, not something called by an event handler.

[ADDED]
7.
When multiple screens are present, the user can choose the configuration; they could be side by side,
on top of each other, with a gap in between, whatever. So simply adding the widths and looking for the maximum height will fail for all but some simple side-by-side configurations.
[/ADDED]

Smile | :)

Luc Pattyn

I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages

Local announcement (Antwerp region): Lange Wapper? Neen!


Questioncopy functionality does not work in CrystalReportViewer Pin
maryam.saboor6-Oct-09 1:02
professionalmaryam.saboor6-Oct-09 1:02 
QuestionBroken Clipping Region Pin
RichardM15-Oct-09 15:26
RichardM15-Oct-09 15:26 
QuestionCustom file format - how to let Windows recognize properties like labels? Pin
pimb24-Oct-09 8:45
pimb24-Oct-09 8:45 
AnswerRe: Custom file format - how to let Windows recognize properties like labels? Pin
Richard MacCutchan5-Oct-09 1:01
mveRichard MacCutchan5-Oct-09 1:01 
GeneralRe: Custom file format - how to let Windows recognize properties like labels? Pin
pimb25-Oct-09 5:17
pimb25-Oct-09 5:17 
GeneralRe: Custom file format - how to let Windows recognize properties like labels? Pin
Richard MacCutchan5-Oct-09 6:25
mveRichard MacCutchan5-Oct-09 6:25 
GeneralRe: Custom file format - how to let Windows recognize properties like labels? Pin
pimb25-Oct-09 6:30
pimb25-Oct-09 6:30 
AnswerRe: Custom file format - how to let Windows recognize properties like labels? Pin
Richard MacCutchan5-Oct-09 7:22
mveRichard MacCutchan5-Oct-09 7:22 
GeneralRe: Custom file format - how to let Windows recognize properties like labels? Pin
Richard MacCutchan7-Oct-09 0:49
mveRichard MacCutchan7-Oct-09 0:49 
GeneralRe: Custom file format - how to let Windows recognize properties like labels? Pin
pimb214-Oct-09 2:52
pimb214-Oct-09 2:52 
GeneralRe: Custom file format - how to let Windows recognize properties like labels? Pin
Richard MacCutchan14-Oct-09 3:01
mveRichard MacCutchan14-Oct-09 3:01 
QuestionBindingSource Insert problem .... Pin
devboycpp3-Oct-09 22:19
devboycpp3-Oct-09 22:19 
QuestionWhy does my visual studio 2008 give me an error of "XMAL editor missing" when I try to use designer in WPF Pin
havegunwilltravel3-Oct-09 9:27
havegunwilltravel3-Oct-09 9:27 
AnswerRe: Why does my visual studio 2008 give me an error of "XMAL editor missing" when I try to use designer in WPF Pin
havegunwilltravel3-Oct-09 9:35
havegunwilltravel3-Oct-09 9:35 
AnswerRe: Why does my visual studio 2008 give me an error of "XMAL editor missing" when I try to use designer in WPF Pin
Mark Salsbery3-Oct-09 11:13
Mark Salsbery3-Oct-09 11:13 
AnswerRe: Why does my visual studio 2008 give me an error of "XMAL editor missing" when I try to use designer in WPF Pin
annathor7-Oct-09 2:10
annathor7-Oct-09 2:10 
Question.net reflactor Problem help Pin
hande543-Oct-09 2:01
hande543-Oct-09 2:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.