Henrik F Nielsen's Q&A profile
.NET Development Get the type of exception
Hello guys I just want to retrieve the type of exception my application does, and depends on that "do something", but how can I evaluate that example: If this type of exception do this etc... if system.IO.FileNotFoundException then do this: I know that the variable ( ex as Exception) have the type of exception, "i read its type", but first how can i retreve it & keep it in some kind of variable and then compare & do some action Thanks Help will be appreciated ex.getType should get the System.Type of the object. ex.GetType.Name would return the System.String that is the name o fthe System.Type. You can also use TypeOf in an If statement to see if t ...Show All
Smart Device Development ActiveSync Calendar Status Deactivated
I cannot synchronize my calendar with ActiveSync 4.2 In status window I can see that calendar is deactivated. How can i activate it This forum is smart device development related. Since your question is not related to smart device development, it's off topic here. Please post to relevant forum or news group: http://support.microsoft.com/newsgroups/default.aspx Closing as off topic. ...Show All
Software Development for Windows Vista Can't query user events but they are in the Database
Hello, I have a workflow with both tracking and persistence, using the shared connection service. Both work fine. I've created a tracking profile that only tracks some of the workflow states, and that also tracks user events. In one of the activities of the workflow, I call the method TrackData and pass some parameters (I've tried with a string and with a class). If I check the database I find the string in the UserEvents table, under UserData_str. If the paremeter was the class instead of the string, I find the name of the class under UserData_str. But when I try to query for that data in my application, most of the times I find that the sqlTrackingWorkflowInstance.UserEvents.count is 0. I queried for all the workflows and in few of th ...Show All
Visual C# Variable scope ina foreach loop
Hi, I get a compiler error when I declare a variable of the same name as the one declared in a foreach loop as the code snippet below shows: foreach ( FileInfo file in sourceDir.GetFiles()) { ...} FileInfo file = testDir.GetFiles()[0]; The error is: "A local variable named 'file' cannot be declared in this scope because it would give a different meaning to 'file', which is already used in a 'child' scope to denote something else" I dont see why this is a problem if the two fiel variables are in different scopes or am I wrong in that assumption If not, then why do I alse get a compiler error if I try to reuse the variable by changing the second line to: file = testDir.GetFiles()[0]; Thanks ...Show All
Visual Studio Visual Studio 2005 Addin
Hello I have an Addin with a toolWindow that works fine. In my ToolWindow I have a ToolStrip. Just my question is in rendering the thema of my toolstirp are differnet to other toolbars of VS2005. How can I render it as the other toolbars. Any idea appreciated. Thanks Mohsen Thank Carlos for your answer. Yes I saw your Control Explorer in MZ-Tools. If you are using windows XP thema you can see your toolbar in Control Explorer looks different to other VS toolbars. I know this is not a problem in rendereing but what I was looking for was the colors that they have used. Regards Mohsen ...Show All
Visual Studio Add icon to a command bar
Hi, I am writing an addin that adds a sub-menu to the VS project context menu, using AddCommandBar. I want to add an icon near the command bar, in the context menu. Is it possible how Thanks. ...Show All
Visual Studio 2008 (Pre-release) Do the LINQ for SQL (May CTP) extensions still work after installing Visual Studio SP1 beta
I would like to upgrade my test Visual Studio 2005 system running LINQ and ATLAS ctps with the SP1 beta. Will LINQ for SQL still work with the service pack, if so will I need to remove/reinstall the LINQ ctp ...Show All
Visual Studio Start Page not functioning
I logged in as an admin and installed VS Pro 2005 on my machine. Everything looks good and seems to be working properly in the admin account. But when I log in as a standard user, the Start Page's Visual Studio Developer News area shows this message forever: "There is no content available yet. Content will be downloaded once a connection to the internet is established." Why is this I need to use my machine as a non-admin. Does anyone know how to correct this I downloaded, installed and tried Fiddler. It shows no HTTP activity for the Start Page (all other HTTP traffic on IE shows fine). When I log in as an admin and test it, the Start Page's HTTP traffic is all shown fine. Weird... So I guess my ...Show All
Visual Studio Express Editions Connecting to an Online Text File
Hey, I was wondering how, if at all, to, in Visual Basic Express, connect to a text file on my server and then pull the contents of that file back into my vb program and set the text of a text box to thos contents. Thanks for reading and I hope you can help. -Joel You would want to look at the StreamReader class for this. Basically, you can do something like this: Dim objFile As IO.FileStream Dim objRead As IO.StreamReader objFile = New IO.FileStream("your File path", IO.FileMode.Open) objRead = New IO.StreamReader(objFile) textbox1.text = objRead.ReadtoEnd objRead.Close() ...Show All
Visual C# Using SerialPort with USB and removing USB cable while port is open
If I open a com port and then remove the USB cable from PC before closing the com port then there is now way I can dispose the com port after that. Not even Environment.Exit(o) works, i.e. I can not exit my program properly. The following code describes the problem: SerialPort port = new SerialPort("COM94"); port.Open(); int n=0; while (n < 10) { n++; Thread.Sleep(1000); } // (Remove USB cable before the while loop has finished) port.Close(); // <-- won't work port.Dispose(); // <-- neither will this Environment.Exit(0); // < ---and not even this one will work How can I work around this Btw the same scenario will appear if the USB device crash I hav ...Show All
Visual Studio SandCastle, Msbuild, and H2Reg
I have updated to the Oct 17 version of sandcastle and update msbuild scripts for the changes in this version. I am successfully building an hxs and can view it correctly with h2 viewer. However, when I register the collection to integrate it with Vs 2005 only the index items appear but nothing shows in the content window. I have search the fourm and can't find anything similar to this issue. Anyone have any clues why the collection looks fine in the viewer but not content in content window in vs2005 thanks, Don Eddleman We have found a bug with Sandcastle generated HxS which I believe is causing this issue. I am working on a fix and will come back with a response. Anand.. ...Show All
Smart Device Development ready boost
my usb 2.0 kingston 1 gb thumb drive is not recognized by vista for use with ready boost. What jump drive can I purchase that meets the performance criteria for use as memory This forum is smart device development related. Since your question is not related to smart device development, it's off topic here. If you’re having a hardware issue, please contact hardware manufacturer or reseller. If you having an issue with 3rd party software, please contact respective software manufacturer or reseller. Otherwise please post to relevant forum or news group: http://support.microsoft.com/newsgroups/default.aspx Closing as off topic. ...Show All
.NET Development Still about MBR object passed to server
I pass a MBR object to server names cmo. In cmo,there is a event member names clientEvent which is fired at server side .When clientEvent is fired,the client method that binds to it will execute. Everything is ok in LAN. My problem happened when the system is set in internet. System.Net WebException occurs when the clientEvent is fired at server side.And here is the information: Execption Message:System.Net.WebException: The underlying connection was closed: Unable to connect to the remote server. Server stack trace: at System.Net.HttpWebRequest.CheckFinalStatus() at System.Net.HttpWebRequest.EndGetRequestStream(IAsyncResult asyncResult) at System.Net.HttpWebRequest.GetRequestStream() at System.Runtime.Remoting.Channel ...Show All
Windows Forms eventhandling---
HI, I'm learning eventhandling . I 've created few classes with the help of microsoft help eg.. But i get error while executing FireEvent like object reference not set to an instance of object. always FireEvent is null. I'm calling FireAlarm from a form. using System; using System.Collections.Generic; using System.Text; namespace WindowsApplication1 { public class FireEventargs :System. EventArgs { public FireEventargs( string roomno) { this .roomno=roomno; } public string roomno; } public class FireEventPublisher { public delegate void FireEventDelegateEventHandler ( object sender, FireEventargs e); public event Fi ...Show All
Visual C# how to call windows application through windows services
Hai, I am currently doing windows services in this i have to create desktop alerts ,can i use windows application and call into windows services Plz any one help me. Thanks & Regards sai In my opnion, you should not be able to do any UI thing from a windows service. Hence, I think you would not be able to have/call windows application from windows service. The service is supposed to run in background without any UI. ...Show All
