where to find static definitions I thought that when you marked a method and class as static that all the objects that the class and methods use have to also be static. Is this not the case Tag: Visual C# Language web parts deploying problem Visual C#
Math with datetime?? There is no "one" answer to this problem. It is all a matter of how you define "age". You haven't provided a rock solid definition of "age" (which, of course, needs to say what to do about the differences in the number of days per month). Tag: Visual C# Language web parts deploying problem Visual C#
Error code: 0xe0434f4d Default .Net security does not allow you to run .Net programs directly from a network share (this is a Good Thing). Normally, you have to copy a .Net program to a local drive before you can run it. However, in your case this looks like it is not possible. One way around it is to change the local machines security policy to allow .Net programs to run from a network drive. (From Control Panel|Administrative Tools -> .Net Framework 2.0 Configuration, and it's somewhere in there...) Tag: Visual C# Language web parts deploying problem Visual C#
app.config or settings.settings Application settings are stored in the app.config file. You'll find a section that contains each of your settings along with the type and default value. This allows the application at runtime to get access to the default settings available. If you define a setting as user scope then the setting will also be stored in the user's local config file (since they won't have write access to the app config). This probably only occurs when the user changes the setting (through your UI). Nevertheless the app.config holds the settings for the application plus the defaults for the user settings.
Now settings.setting is a code file. If you open it up (the actual source file, double clicking will take you to the project's settings page) you'll find that it is nothing more than a class that exposes each of the settings from the config file as properties. This allows you to programmatically access the settings at runtime without having to interact with the configuration subsystem (which is how you access the app.config) file.
You almost never should mess with the settings.setting file. It is dynamically generated each time you use the project property pages to add or edit a setting. You should also normally not muck with the app.config settings either as you might mess up the syntax. Instead you should use the project's property pages to add and edit settings. However if you wanted to, for example, copy the settings from one application to another you could open the app.config file and copy the section from one application to another. You would then need to open the project's property pages to force the IDE to generate/update the settings.setting file.
Michael Taylor - 12/28/06 http://p3net.mvps.org Tag: Visual C# Language web parts deploying problem Visual C#
closing app probs ahmedilyas wrote:
Perhaps your application is still doing something in the background Such as creating another thread which is still running and hasnt finished yet
What does your application exactly do Are you sure your are not looking at the application .vshost instance in task manager whilst you are running an instance of VS with that solution loaded (some people do get confused) the aplication uses a while loop(BoolExit =! false) to check if a process is running. if the process exited the app will start the process again.(a restarter) If i click the stop Button (BoolExit = true) and the loop will break. Some of the user i got they dont click the stop button they only click the X button to exit. the while loop stays open and the app windows closes, and the process keeps restarting. Tag: Visual C# Language web parts deploying problem Visual C#
calling an executable from within running app I have been looking for a couple of days now and I suppose I am just looking in the wrong places. As I have recently started migrating my knowledge from that of C / C++ to C# so I still have much to learn; However I would be most grateful if someone could point me in the right direction. Have also performed multiple searches and perhaps I am just not succint enough in what I am typing to find that which I seek. While keeping in mind I am also just now learning to program within Windows most all previous experience within C / C++ has been within Linux / Unix and previous to that was all assembly and C/C++ within DOS years back. So, I have much to learn reiterated once more.
I am looking for something within the C# language that would be equal to that of the C - ansi / posix function 'system("foobar.exe");' So that I can call an executable from within a running app.
TYVM in advance
Erin Ferguson-Stange Tag: Visual C# Language web parts deploying problem Visual C#
Best way to marshal an array of C style strings Yes. Another option is to split the field into seven different strings of length 30 if that's more conventient. You can also use a char[] instead of a string if you prefer. Tag: Visual C# Language web parts deploying problem Visual C#
How can I control already open IE windows? I ended up using SendKeys and creating a new instance of IE each time a user clicks on the button. Some helpful links I came across: http://msdn2.microsoft.com/en-us/library/66ahbe6y(vs.71).aspx http://www.webtropy.com/articles/InternetExplorer.asp Internet%20explorer Tag: Visual C# Language web parts deploying problem Visual C#
VB6 ActiveX Dll Problem ! After compiling a activeX dll in VB6. I had tried to use it in my C# application : [DllImport ("MyLib.dll",EntryPoint="Function1")] private static extern int MyFunc (int _num); -> I get an exception "Entry Point not found !" It's my activeX Dll code : public function Function1 (byval num as long) as long ..... How to reuse this dll, Somebody help me ! Tag: Visual C# Language web parts deploying problem Visual C#
Add a Menu to the IDE I want to Add a seperate menu to the visual C# IDE!
is it possible...to do
add a seperate menu to the default visual studio 2005 IDE.
(Say after the HELP menu.)
OR putting as another item in an existing menu.
(Say in the TOOLS menu)
how to do it!..is it possible Tag: Visual C# Language web parts deploying problem Visual C#
How to check whether the system is 32 bit or 64 bit ? Hi Martin,
Thanks for the reply.
I have two applications.
(a) A Window App on which the code is working fine to give the OS Version as intended. The OS is 64 bit and it rightly displays
(b) An Outlook VSTO Addin (A plugin which gets added in Outlook 2007) but the same code says that the OS is 32 bit.
Both of the above applications have been developed on a 32 bit machine.
Any ideas Tag: Visual C# Language web parts deploying problem Visual C#
how to call a function of another class hi i am trying delegate but i have been having trouble with an error talking about cant deserialise at the security level i recenrly found a way for it to be solve but the code is in the app.config file
<serverProviders>
<formatter ref="soap" typeFilterLevel="Full" />
</serverProviders>
how can i add it into my code to cater my program can help me Tag: Visual C# Language web parts deploying problem Visual C#
Please help me with C# code I've just started C#, but I have been doing some terminalIO stuff in java and one of the java apps calculates pi. the math should be the same.---- import java.util.Scanner; public class PiCalculator{ public static void main(String[] args) { // Declare Variables Scanner reader = new Scanner(System.in); double pi; double x = 1; double count = 0; double no = 1; double pi2 = 0; double end; double piCurrent; //request input System.out.print("Enter number of iterations: "); end = reader.nextDouble(); //Calculations while(count < end) { pi = pi2 + (no / x); x += 2; no *= -1; pi2 = pi; piCurrent = pi2 * 4; count ++; } pi = pi2 * 4; //Display the value System.out.println("The value of pi after " + end + " iterations is " + pi + "."); } } Tag: Visual C# Language web parts deploying problem Visual C#
Trim transparent whitespace from Image I would like to trim the alpha whitespace from an existing Image (read from a png). For example: A big transparent image with a small solid circle somewhere shall be trimmed down to a rectangle bearing the circle. Is there some high level method I can use Tag: Visual C# Language web parts deploying problem Visual C#
The process cannot access the file **HARD ONE** Yea I seem to remember that thread too. I think you got it. Essentially, creating a new bitmap of the original one and then disposing of the original to free the resources. Tag: Visual C# Language web parts deploying problem Visual C#
Reflection For Class Hi Friends, IĄ¯m new to reflection, what I want isĄ List<FOUnitClassMst> objFOUnitClassMst = new List<FOUnitClassMst>(); FOUnitClassMstBl objFOUnitClassMstBl = new FOUnitClassMstBl(); objFOUnitClassMst = objFOUnitClassMstBl.SelectAll(); sXMLReturnString = objGenSerial.XMLSerialize(objFOUnitClassMst); the above is the code what I have in my current project, I want to implement reflection. I just want to know if this can be done. If this can be done then can any one help me in coding I will pass the class FOUnitClassMst as string, and even FOUnitClassMstBl as string. If needed I will also pass SelectAll() method to it. I want to convert the above string to list of object, and then convert FOUnitClassMstBl to object which is a business layer, I want to execute a method called SelectAll() which resides inside the business layer FOUnitClassMstBl . How can I achieve this Please reply back if any one know the solution for this, I badly need this to be done. Tag: Visual C# Language web parts deploying problem Visual C#
Navigation from one form to another in Windows applications (C Sharp) There's not a built-in method to do this as far as I know, but you could write it yourself. If you actually want to close the forms as you transfer control, you can call the Close method on the forms, but you will need to take special care that the message loop doesn't end.
I'm trying to picture how this program will look, though, and it seems very strange, with forms popping up and closing as you perform tasks. You should seriously try to have a main form to the application if you can, since it will provide a logical point of reference for the user. Perhaps you should consider keeping one form open the entire time, with navigation between various UserControls or Panels. This could behave a bit more like web page transitions without doing crazy stuff having windows closing and opening all over the place. If you already have a lot of work done designing the forms, you could copy that into the UserControls without too much effort. Tag: Visual C# Language web parts deploying problem Visual C#
Which Namespace contains NullToString ? The method simply doesn't exist in the current contex, but your method should look like the example below. In .NET 2.0 you can use the String.IsNullOrEmpty method: public static bool isEmail( string inputEmail) { if ( inputEmail == null || inputEmail.Lengt == 0 ) { throw new ArgumentNullException( "inputEmail" ); } const string expression = @"^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}" + @"\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\" + @".)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\] )$"; Regex regex = new Regex(strRegex); return regex.IsMatch(inputEmail); } Tag: Visual C# Language web parts deploying problem Visual C#
Format CSV using C# Tony did post some sample code, now it's up to you to put some effort in it... (And if that doesn't work, post the code you've tried, and tell us what is going wrong... But don't expect us to do your homework.) Tag: Visual C# Language web parts deploying problem Visual C#
Back/Forward buttons You don't need webBrowser.CanGoForward and webBrowser.CanGoBack... For your forward button you need to put webBrowser1.GoForward(); and for your back button you need webBrowser1.GoBack(); in your click events... That's all you need!! Tag: Visual C# Language web parts deploying problem Visual C#
IO Exception when Deleteing a File Hi Khin...
Thanks for the tip. I tried the sleep trick ... but it did not work. I made the code run in debug mode and it waited a min before I let the delete execute. .
- Paul Tag: Visual C# Language web parts deploying problem Visual C#
Creating Sequental filename. Hi,
Store the next number in a file within the directory where the files are written. If someone accidently deletes the file then have your application crash with a rude error message, no if the file is missing then do your idea.
If your worried about another thread causing problems then mark the code as a critical section using Thread.BeginCriticalRegion and Thread.EndCriticalRegion. This will ensure the thread completes the task of saving the file. Tag: Visual C# Language web parts deploying problem Visual C#
Initializing base class with a child class instance Hello, I have two classes say BaseClass and ChildClass. Second one is derived from first. I am creating object like
Code Block
BaseClass obj = new ChildClass(); This works correctly. But when we need such a instantiation And what is the benefit of doing so Any help will be appreaciated. Tag: Visual C# Language web parts deploying problem Visual C#
unique song identifier from an mp3 Hi guys,
Interesting ideas, I am certainly gone give it a shut!
Thanks a lot for your inputs! Tag: Visual C# Language web parts deploying problem Visual C#
Visual Studio 2005 Standard vs Professional Sorry for the delay. Rather than guessing I hunted down a copy of Standard so I could compare it to the higher end versions. I'm comparing it against VS Team Suite but TS doesn't add much over Professional in the area of UI.
On the UI side I really don't see any differences beyond what projects and tools are available in the other products. For example unless you're running Team Edition you won't have the performance or code analysis tools. Database support is in the standard edition but you can't create database projects from what I can tell. XML files themselves are supported along with the various views but debugging and whatnot might not work. Macros, snippets, addins, etc are all there as well.
Therefore I'd say the biggest factor is whether you want DB and XML support along with code analysis, testing and/or performance tools. If so then you might want to consider moving up to a "higher" version. Otherwise standard might be good for you. From what I vaguely remember (and I could be completely wrong) Standard is designed for the programmer who lies between a hobbyist (Express) and a professional programmer (Professional). Perhaps a student, part-time programmer or someone who just wants to create their own dynamic web site.
Michael Taylor - 1/22/07 http://p3net.mvps.org Tag: Visual C# Language web parts deploying problem Visual C#
Get the installation location of a assembly through c# We are building a project where a template uses a c# assembly.
At runtime we want to retrieve the folder where the assemby was installed.
with
Code Snippet
System.Reflection. Assembly .GetExecutingAssembly().Location
we only get a location to the current location of the assembly and not the installation path. Is there another way to find out
Thanks,
Arwin van der Laan Tag: Visual C# Language web parts deploying problem Visual C#
dll decompile You can use Lutz Roeder's .NET Reflector. Take it from here: http://www.aisto.com/roeder/dotnet/ Tag: Visual C# Language web parts deploying problem Visual C#
Process: VirtualMemorySize64 Question Hi,
unless the process exposes this information in some other way I doubt you will be able to find this information, a process is a security boundary, normally a processes memory cannot be accessed by another process.
Mark. Tag: Visual C# Language web parts deploying problem Visual C#
How can I create an empty XmlElementString with XmlWriter i can see you already have that in the code and it should work
tw.WriteStartElement( "variable", String.EMpty ); Tag: Visual C# Language web parts deploying problem Visual C#
Thread I'm also regularly using an EventWaitHandle (ManualResetEvent/AutoResetEvent) in combinition with the following snipet:
Code Snippet
WaitHandle[] handles = new WaitHandle[] { exitEvent, null };
while(!exitEvent.WaitOne(0, false))
{
IAsyncResult result = something.BeginSomeMethod(null, null);
handles[1] = result.AsyncWaitHandle;
if(WaitHandle.WaitAny(handles) == 0)
{
break;
}
something.EndSomeMethod(result);
}
I coded this just from memory so no garanty of correct syntax!
To exit the thread I use exitEvent.Set() on any thread which wants to stop the thread. This call is often followed by a thread.Join(); Tag: Visual C# Language web parts deploying problem Visual C#
Cannot Convert type 'char' to System.DateTime' If it is arraylist (of which type again),
how can the TickData[0] be of type DateTime and theTickData[1] be double type as u r using in for each loops
Thanx,
Ch.T.Gopi Kumar. Tag: Visual C# Language web parts deploying problem Visual C#
vsvinodvinodkumar
i am using visual studio2005.after deploying the webparts (publishing the website and creating the virtual directory),the web page is displaying.but the drop down button is not displaying .also iam not able to drag and drop web parts. Is there another way for deploying web parts(without using share point server). please reply me