|
|
sorry about the breakpoints just slipped my mind:->
the exception comes on the statement
AddTable adt=new AddTable();<br />
adt.MdiParent=this;<br />
adt.Show(); <-----exception<br />
|
|
|
|
|
Hi,
the most likely reason for this is that you ran out of memory.
arent you creating many and/or big objects every time you cluick that menu item
(in such a way that they dont get disposed and garbage collected when your menu item handler
is done) ??
|
|
|
|
|
how can it run out of memory even if its the very first form i'm trying to open through the menu item after i run the application???
and since its the very first task i perform after running the application there aren't any item or garbage to dispose of, besides this just happens with one particular menu item as all the rest function okay.
any other suggestions???
|
|
|
|
|
Hi,
showing the code may be helpful.
|
|
|
|
|
You've been using various object and not disposing of them properly when you're done. You can get the OutOfMemory exception when the Windows handle pool is exhausted. Restart your machine and it'll clear itself up.
Checking for handle leaks is pretty easy. Open TaskManager (Ctrl-Shift-Esc) and click on the Processes tab. Click the View menu and Select Columns... Turn on the Handle Count option and click OK.
Now, widen up the Task Manager window so you can see the Handles column. Start your application and find it in the Task Manager Processes window. Look at the handle count. Exercise your application. Do everything you can in it, repeatedly, and watch the Handles count. If it just keeps climbing, your app is allocating various unmanaged resources, like window handles, brushes, pens, fonts, file handles, graphics object, ... and not freeing them properly when your code is done using them. This will eventually lead to the OutOfMemory exception that you got.
A code review is in order. Any graphics-oriented object must be Disposed when your done using it. Any forms displayed with a call to .ShowDialog() must be Disposed. Any file object you use must be Disposed. The list goes on, but those are the most common problems...
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
What about dispose of brushes/graphic objects? those can also lead to out-of-mem.
|
|
|
|
|
|
Hi,
answering one question:
everytime you do a "new Something()" of a class Something that has a Dispose() method,
you are supposed to call Dispose() as soon as you are done with that object; if you dont,
you are likely to get memory leaks (which a gc cannot solve for you).
|
|
|
|
|
thanks or reply and ur times.
my application started working all of a sudden however i'll have to check for its such unstable behaviour.
Thanks once again
Regards
Saira
|
|
|
|
|
That is if you have created your custom .. e.g if you're creating new Brush objects for paiting custom icons/images on your menu, but left out the dispose part by accident, this is possible.
you could do:
Brush b = null;<br />
try<br />
{<br />
b = new ...<br />
}<br />
finally<br />
{<br />
b.Dispose();<br />
}
OR
using (Brush b = new ...)<br />
{<br />
}
The using expression takes any object that implements IDisposable. I prefer the "using" for cleanliness, and never having to forget the 'dispose' portion in finally.
- Malhar
|
|
|
|
|
i'm not using any Brush or such graphic objects.
my application started working correctly all of a sudden (by itself) without my doing anything to it.
i must research on its peculiar an odd behaviour
Any ways thanks for ur time and plz do lookup the second query i've just posted.
Regards
Saira
|
|
|
|
|
I am trying to apply an Asymmetric Encryption (RSA) for file. Since the cryptographic provider needs byte inputs, the server gets overwhelmed typically in case of huge files in the magnitude of 50 MB.
Any pointers towards split and encryption?
|
|
|
|
|
Hello,
I am using a WebBrowser control, that is there to display the HTML file. It has some links. The problem is, I don't want those links to change the colour when user clicks on them. I supress the link from poping up, but the colour on the hyperlink changes.
Is there a way of keeping the same blue colour?
Thank you.
|
|
|
|
|
Here's a style fragment that will cause the hyperlink to always render in blue:
A:link { color: #0000FF; text-decoration: none; }
A:visited { color: #0000FF; text-decoration: none; }
A:hover { color: #0000FF; text-decoration: underline }
A:active { color: #0000FF; text-decoration: none } /ravi
|
|
|
|
|
Yeah, but this has to be done in the document itself. I guess there is no property on the control itself to control the hyperlink colours.
Thanks.
|
|
|
|
|
If you're programatically navigating the control to a URI, you could modify the HTML (i.e. inject an inline internal style) before setting the web browser control's content.
/ravi
|
|
|
|
|
Don't I need a style sheet for that? Or I can do it the same way I am setting the background colour for the webbrowser control. How would the HTML contents look like?
Thank you.
|
|
|
|
|
Sorry, I meant an internal[^] style, not an inline style.
/ravi
|
|
|
|
|
hi, I am trying to get the data from datatable in to DataTableReader so i can read the data like datareader.
I am getting error "DataTableReader is invalid for current DataTable" when trying to call the GetValues method on DataTableReader.
Please shed some light. If it helps here is my code in C# 2.0
public void Execute()
{
using (DataTableReader dataTableReader = new DataTableReader(myDataTable))
{
object[] values = new object[dataTableReader.FieldCount];
int fieldCount = dataTableReader.GetValues(values);
string id= values[4].ToString();
string Type = values[0].ToString();
}
}
i am poppulating a datatable from SQL 2000 database and is getting 4 rows back ( i can see that in datatable viewer in debug mode). I am also able to get the field count on datatableReader which is 6 (=number of columns).
However, when i get to the point where i need to get the values from the dataTableReader using
dataTableReader.GetValues(values), that's where it breaks up and states "DataTableReader is invalid for current DataTable"
Please shed some light
Thanks
Needy
|
|
|
|
|
Hey!
I'm new in c#, and i'm trying to make a template browser, that stores html strings in variables.
My problem is, how do i store the html to a string?
The html looks something like this:
<br />
<HTML><br />
<HEAD><br />
<title>test</title><br />
</HEAD><br />
<BODY><br />
<a href="http://www.codeproject.com/">link</a><br />
</BODY><br />
</HTML><br />
I have tryed this "string html = @"<The html>"; " but doesn't work
Any suggestions?
-- modified at 11:42 Thursday 22nd February, 2007
|
|
|
|
|
Scripter47 wrote: but doesn't work
Can you explain what you mean by "doesn't work"?
/ravi
|
|
|
|
|
When i have a code like this:
string html = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">
<html xmlns=\"http://www.w3.org/1999/xhtml\">
<head>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />
<title>Untitled Document</title>
</head>
<body>
</body>
</html>";
Then it wouldn't compile
How do I do it?
|
|
|
|
|
You cannot stretch a string literal across multiple lines like that. It should be:
string html = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" " + "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\"><html " + "xmlns=\"http://www.w3.org/1999/xhtml\"><head><meta http-equiv=\"Content-Type\" " + "content=\"text/html; charset=iso-8859-1\" /></head><body></body></html>";
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cookwww.troschuetz.de
|
|
|
|
|
Scripter47 wrote: it wouldn't compile
Right - that's incorrect syntax. A string literal can't include an unescaped new line character. One way to do it is to use the string concatentation operator.
string html = "<!DOCTYPE html PUBLIC ...";
html += "..."; /ravi
|
|
|
|