|
Ah yes, that behaviour is really a nuisance. I've come across it some time ago and had a discussion with someone from M$ in some newsgroups, but he didn't tell why .NET behaves like this.
Basically, it's the same effect when you get when you encapsulate a ShowDialog() in a try/catch.
When you run the app from VS.NET, the exception is caught, when you start the application from outside you get the unhandled exception dialog.
To fix the problem you'll have to add a ThreadException handler to your app and then rethrow the exception:
static void Main()
{
try
{
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);
Application.Run(new Form1());
}
catch (Exception ex)
{
MessageBox.Show("Exception caught in Main:\n"+ex.ToString());
}
}
private static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
throw e.Exception;
}
Hope this helps,
mav
|
|
|
|
|
Thank You! That worked like a charm.
Thanks,
Rob Tomson
--
There are 10 kinds of people. Those who understand binary and those who don't.
|
|
|
|
|
I have been fooling around with the Windows Media Player COM component. What I am trying to do is have the playlist be tied to a listbox from which they can add/remove and play songs. The problem I am having is that I cannot find a way to change the internal playlist selection in the Windows Media Player component. If I simply set currentMedia, then the internal playlist disappears. Anyone know a solution?
|
|
|
|
|
I had success maintaining my own playlist, and catching the events to tell me when to play the next file. I had no success building playlists in WMP.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have worked around the WMP playlist but, as suggested above, maintaining the events externally. I places buttons on top of the WMP control to simulate the Next and Prev buttons (viz. screenshot, extract, overlay). If anyone is interested in the code I'd be happy to share. I have the next/prev working as well as auto-playing the next file in the playlist. Going to be working on randomizing playback soon.
|
|
|
|
|
i'm trying to create a user control that uses the MouseDown event, problem is when the user uses the control and edit this function for it his function is executed first instead of my own original MouseDown function.
is there a way to control/change the order of this events on run time?
|
|
|
|
|
Hi,
I have a DataGrid bound to a DataTable. I used the following code to bind the DataTable,
//
//Set the datasource of the Grid
//
this.dataGridPCUD.DataSource = this.dataTable;
There is a save button that user clicks to save the information. The problem is that when the user
makes changes and clicks Save, the information from the last cell of the GRID is not seen by the
DataTable.
I used the following code to get the changes
CurrencyManager currencyManager = (CurrencyManager) this.dataGridPCUD.BindingContext[this.dataTable];
if (currencyManager != null)
{
currencyManager.EndCurrentEdit();
currencyManager. Refresh();
}
DataTable subDataTable = this.dataTable.GetChanges(DataRowState.Modified);
The heilighted line returns null. But when I check the new value in the DataTable, I see the modifies value.
Everything works fine if the uses tabs out before saving.
Please advise.
Thanks and Regards,
Alomgir Miah
|
|
|
|
|
Hi! i was wondering how to display all the properties for an AD object based on one of it's properties? I'm trying to show a user all there properties based on their NTID (username).
Any help would be great!
joel
|
|
|
|
|
i need to delete during the uninstall of my application a directory if exists and regstrykeys created by another my software installed on the pc.
How can i do?
Is it possible?
|
|
|
|
|
Hi All
I want to show the XML file nodes in a tree view for selection, and then the selected nodes to write in another XML file.
Please Guid me if any one know these things.
Best regards
INAM UL HAQ
|
|
|
|
|
Hi,
Please use XmlReader to read the Tree and Load it into Tree recursively.
XmlWriter will do the job of writing.
Here is the code Snippet
void LoadTree()
{
while (xmlTextReader.Read())
{
switch (xmlTextReader.NodeType)
{
case XmlNodeType.Element:
tempTreeNode = new TreeNode( xmlTextReader.Value.Trim());
break;
case XmlNodeType.Text:
Console.Write(xmlTextReader.Value);
break;
case XmlNodeType.CDATA:
Console.Write(xmlTextReader.Value);
break;
case XmlNodeType.ProcessingInstruction:
Console.Write("");
break;
case XmlNodeType.Comment:
Console.Write("");
break;
case XmlNodeType.Document:
Console.Write("");
break;
case XmlNodeType.Whitespace:
Console.Write(xmlTextReader.Value);
break;
case XmlNodeType.SignificantWhitespace:
Console.Write(xmlTextReader.Value);
break;
case XmlNodeType.EndElement:
if ( currentTreeNode != null )
{
if ( currentTreeNode.Parent == null )
{
currentTreeNode = null;
}
else
{
currentTreeNode = currentTreeNode.Parent;
}
}
break;
}
}
xmlTextReader.Close();
}
}
This code is not complete but will give you the idea.
Hope this helps,
Alomgir Miah
|
|
|
|
|
I've tried to serch in the web and in the site but i've founded nothing.
I need a function that return int random number:
int myn = RandomFunction(100);
it could generate number between 0 and 99.
Does it exist?
|
|
|
|
|
Gee, you must've searched really hard
Random[^]
|
|
|
|
|
look at the Random class in the .net framewok.
/\ |_ E X E GG
|
|
|
|
|
eggie5 wrote:
look at the Random class in the .net framewok.
Gotta look great in email notification! (or is it only my lame english? I read it like he should randomly pick one of .NET classes...)
David
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
I don't get this message either (alluding to the other message of yours in the lounge I misinterpreted).
/\ |_ E X E GG
|
|
|
|
|
eggie5 wrote:
I don't get this message either
That's my usual problem.
When he gets message notification in email, it's without <code> formating, I belive. So when you don't pay attention to case, you end up reading "look at the random class in the .net framewok.". Ohh hey! I think I get it! "look at the random class in the .net framewok." vs. "look at brandom class in the .net framewok." makes the difference, right? Ok so I would think that you are saying to pick *random* .NET class.
David
Never forget: "Stay kul and happy" (I.A.)
David's thoughts / dnhsoftware.org / MyHTMLTidy
|
|
|
|
|
DEar Friends
I am developing web page in asp.net with C# i am using the Calender by acme tag
when i m opening the page it gives error as below
Parser Error Message: File or assembly name Acme, or one of its dependencies, was not found.
Source Error:
Line 1: <%@ Register TagPrefix="Acme" Namespace="Acme" Assembly="Acme" %>
Line 2:
Line 3: <html>
Source File: c:\inetpub\wwwroot\intro7.aspx Line: 1
Thanks
Murtuza Patel
|
|
|
|
|
Remember to add a reference to the acme assembly, simply a using statement is not enough.
|
|
|
|
|
Hi,
I'm trying to activate a process on a remote machine and doing so successfuly. The only problem is that I' havn't figured out how to know when the process has ended.
here is an example of the code:
private void run_notepad(string machina)
> {
> ManagementOperationObserver observer = new
> ManagementOperationObserver();
> completionHandler.MyHandler completionHandlerObj = new
> completionHandler.MyHandler();
> observer.ObjectReady += new
> ObjectReadyEventHandler(completionHandlerObj.Done);
>
> string stringMachineName;
> string stringCommandLine;
> stringCommandLine="c:\\winnt\\notepad.exe";
> //Connect to the remote computer
> ConnectionOptions co = new ConnectionOptions();
> stringMachineName = machina;
> //get user and password
> if (machina!="")
> {
> co.Username = "aaa";
> co.Password = "******";
> }
> //Point to machine
> System.Management.ManagementScope ms = new
> System.Management.ManagementScope("\\\\" + stringMachineName +
> "\\root\\cimv2", co);
> //get process path
> ManagementPath path = new ManagementPath( "Win32_Process");
> //Get the object on which the method will be invoked
> ManagementClass processClass = new ManagementClass(ms,path,null);
> //Create an array containing all arguments for the method
> object[] methodArgs = {stringCommandLine, null, null, 0};
> //Execute the method
> processClass.InvokeMethod (observer, "Create", methodArgs);
>
anybody knows how to tell when the process exited?
Thanks,
Haim.
|
|
|
|
|
Hi
How can I select a treenode (in coding) on a treeview and keep it selected (High Lighted)?
I tried the following and it doesn't seem to work as required:
foreach ( TreeNode tn in treeView1.Nodes )
{
if ( tn.Text == "Color" )
{
treeView1.SelectedNode = tn
break;
}
}
|
|
|
|
|
Why isn't it "working as expected"?
That's how you select a node, no need to perform different or additional voodoo.
Could it be that your TreeView hasn't got focus and HideSelection is set to true?
Or that there _is_ no node with Text "Color"?
mav
|
|
|
|
|
Ok must be that the treeview hasn't got focus...
Thanks
|
|
|
|
|
Hi all,
I have a ToolBar on my form. Each button associated to an image from an ImageList .
Why when I disable the button, the button becomes all gray ( and not grayscale image ) ?
Do I have to apply a second grayscale image for each button for disable mode ?
If so, How do I do it ?
|
|
|
|
|
here is my problem.
i have a RichTexBox with a document in it. after some modifications it needs to be printed. however in the printed version no white spaces must be left from the end of a paragraph to the end of the line.
i have tried to adjust the size of the RichTextBox to the size of the paper used by the printer (usualy A4) and set left and right indentation of text (making a copy of the rtf before this in order to print it unindented, otherwise it will just double the indentation) accordingly to printer settings indentation values.
however print preview and printed version text differs from the one shown on screen. the text is printed as formated text with justified align and different fonts and sizes, using a control derived from RichTextBox witch has such printing support described here
now if anyone has any ideas as to how i can atleast hadle this problem ..
|
|
|
|