|
Especially for things like Graphics and Forms you really need to call Dispose on them. It is not sufficient to just "disconnect" them from the managed memory space because there are handles behind the objects.
Try this instead:
<br />
Form child = this.MdiChildren[i];<br />
this.MdiChildren[i] = null;
child.Dispose();
|
|
|
|
|
Thank you, Tom.
The above code doesn't release the memory.
The problem is that
this.MdiChildren[i] = null;
doesn't work!!!
After this line you can simply execute something like this:
this.MdiChildren[i].Show();
and no crash!!!
By the way, if I open the child form without assigning MdiParent
to it, it releases the memory correctly.
Thank you again.
Gena
|
|
|
|
|
Hello ..,
I was just wondering if any1 knows how to insert a flash MX movie in C#.net? I've created a ref of Shockwave flash but i couldn't make it work. It gets null.
Code example would be greatly appreciated.
Ta
Bob
|
|
|
|
|
Mehbub wrote:
Code example would be greatly appreciated.
There are several articles on the Internet regarding this. I just did a quick search and came up with Using Flash With C#[^]. Lutz Roeder was also working on a Flash player in C#, it's here[^]
- Nick Parker My Blog | My Articles
|
|
|
|
|
Hi All,
I create Windows form with 2 combobox, first combobox(cmbOwners) is set up from properties, and second one (cmbVessel) from code. Idea is when i select Owner from first combobox in second will show vessels releated with that owner. I have code on cmbOwner SelectedIndexChanged event :
private void cmbOwner_SelectedIndexChanged(object sender, System.EventArgs e)
{
cmbVessel.Items.Clear ();
dsVessel.R8.Clear ();
daVessel.SelectCommand.CommandText =
"SELECT * FROM R8 " +
"WHERE R1 = '" +
cmbOwner.SelectedValue + "'";
daVessel.Fill (dsVessel);
cmbVessel.DataSource = dsVessel;
cmbVessel.DisplayMember = "R8.Nm";
cmbVessel.ValueMember = "R8.RNo";
}
and code is working find only first time when i select owner,but on the second try i get error :
"An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dll
Additional information: Cannot modify the Items collection when the DataSource property is set."
Can anyone help me with this.
Thanks
|
|
|
|
|
Fule wrote:
private void cmbOwner_SelectedIndexChanged(object sender, System.EventArgs e)
{
cmbVessel.Items.Clear ();
dsVessel.R8.Clear ();
daVessel.SelectCommand.CommandText =
"SELECT * FROM R8 " +
"WHERE R1 = '" +
cmbOwner.SelectedValue + "'";
daVessel.Fill (dsVessel);
cmbVessel.DataSource = dsVessel;
cmbVessel.DisplayMember = "R8.Nm";
cmbVessel.ValueMember = "R8.RNo";
}
I think your problem is the cmbVessel.Items.Clear(); line. You don't really need to do that, since you are changing your DataSource anyways. Comment out that line and you should work better.
- D
|
|
|
|
|
Thanks , is working
|
|
|
|
|
Is there an easy way to set the width of Columns in a ListView so that they cannot be interactively resized at runtime ? I could not find any property of the ListView class to obtain that.
Thanks
Maurizio
|
|
|
|
|
in .net 2.0 you can handle ColumnWidthChanging event and cancel resize. I'm not sure if there is anything in 1.0
|
|
|
|
|
Hello!
I'm creating an mp3-player using DirectShow and I've got a problem. I want to show the length of the audiofile I'm playing but I can't figure out how.
When I'm e.g. playing an audio file with a length och 46sec the code below shows a length of 195sec (3m 15sec), why? Both Duration and StopTime shows the same length.
private IMediaPosition _mediaPosition;
_mediaPosition.Duration;
_mediaPosition.StopTime;
I've tried to find a pattern by playing different audio files but I have not found one.
I've looked at these pages but they seem to have the same problem.
DirectShow - Playa
DirectShow - MediaPlayer
Thanks!
Erik
|
|
|
|
|
Hello!
It's me again. I just figured out that Duration and StopTime works at some files.
Is'nt Windows MediaPlayer using DirectShow? Because Windows MediaPlayer can't get the correct length of all the files I've tested.
/Erik
|
|
|
|
|
|
I need help to make server which can accept connections from mobile using wap .. actully I am nebibe in .net and previosly was working with java and c++ languages ..
I need urgent help for resourses to look for and what to study ..
I am a enggeniring student ..
Regards
shubham shrestha agrwal
do best wherever u r
|
|
|
|
|
i need to draw a line that goes over sevral controls that are docked on a tab page , but when i used the graphics object of the tab page i didnt see the line, how can i draw this kind of line? (do i have to use all the graphic objects of all the controls in its way?)
|
|
|
|
|
The requirement is to paint the lines ON TOP of the controls, not behind them. Some controls don't work very well with transparent backgrounds and some controls don't even support transparent backgrounds.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Try overriding the OnPaint event of your form. Call the forms base OnPaint event and then draw your lines as required. This should put your lines on top of the controls painted by the base OnPaint handler.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hy everyone!
What I want to do is when rightclicking on a ContactItem I do want my proggy to be listed in there with a MenuItem. This should either start my programm or if it is running bring it on top and/or send the data of the selected object to it.
Well the actions which have to take place when being selcted shouldn't be the problem but at the moment I have no idea how to get this MenuItem into the contextmenu when clicking on a contact.
I found samples which created new MenuBars, but that's not what I want. I do want to add an item to an existing menu.
Does anyone of you know how to do this? Well the best thing is this being possible no matter which version of Outlook I do use. Or if the solution depends on which version I do use then I would like to implement it on Outlook 2000 for testing at the moment.
Thanks!
Stephan.
|
|
|
|
|
From my point of view you won't be able to edit any context menu of Outlook, meaning you won't be able to add any item to them, right?
As far as I know you are only able to add an item to a MenuBar. This should be described in the MSDN or elsewhere!
Or is it possible to edit context menus of Outlook? Because if it is possible then I would be interested as well and I would be happy if anyone was willing to provide me some code to show me how to do this.
(This code doesn't have to be this specific like in Stephans request, any "standard code" for editing or adding an item to the context menu is what I would be looking for!)
|
|
|
|
|
I want to add a Link label to a form ,and when a user clicks on it the browser opens and navigate to that link
in the .net help the follwing code has been given
protected void LinkLabel1_LinkClicked(object sender, System.EventArgs e)
{
// Change the color of the link text by setting LinkVisited
// to True.
linkLabel1.LinkVisited = true;
// Call the Process.Start method to open the default browser
// with a URL:
System.Diagnostics.Process.Start("http://www.Microsoft.com");
}
but it didn't work bcos the app enters to the debug mode..any suggestions?
samitha
|
|
|
|
|
thnx 4 the reply
Is this property comes with LinkLabel..?I have gone through the properties but did not come accross such a property...any suggestions?
samitha
|
|
|
|
|
Ummmmm.....no, won't work...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
The NavigateUrl method only works with the WebBrowser object. This person is trying to launch the URL as a seperate process, just like double-clicking on a web shortcut on the desktop.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Try creating a Process object and alter the ProcessStartInfo properties to UseShellExecute . Something like this:
Process webLink = new Process();
webLink.StartInfo.FileName = "http://www.microsoft.com";
webLink.StartInfo.UseShellExecute = true;
webLink.Start();
This will launch the URL as if you typed it in the Start/Run box of Windows.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
I use an ordinary tree view inside a dialog, but I wish to write a text saying "No data available"
if the treeview (which is filled with items loaded from files) is empty.
Instead of just adding a node saying "No Data Available", which doesn't look very good,
I'd like to set a flag in the control (The control is a very thin wrapper for the API's treeview)
and when that flag is set draw the string centered in the treeview instead.
I found somewhere on google that this was only possible using Win32 messages with p/invoke.
My question is, how do I do this? I get the handle of the control and send some kind of paint message?
I haven't been into painting in WIN32 very much...
can anyone help me?
|
|
|
|
|
The TreeView class is simply a wrapper around the Win32 TreeView control. You could simply subclass the TreeView and add your P/Invoke statements there. Depending on what you want to do, you could do something as simple as the Win32 function DrawText . The P/Invoke signature looks like this:
[DllImport("user32.dll")]
static extern int DrawText(IntPtr hDC, string lpString, int nCount,
ref RECT lpRect, uint uFormat);
Also, you could just use the Graphics object and call the DrawString method. It all depends on what you are doing, this should get you started.
- Nick Parker My Blog | My Articles
|
|
|
|