|
A single process can have multiple domains running within it
|
|
|
|
|
Hi!
I have problem in using media player control in web application. Can anyone guide me how can i get this control in web application and how can i use it.
Waiting for urgent reply.
Thanx
|
|
|
|
|
Hi.
About generics ...
We can give the object type to any method or field in a class,
and in compile time pass the disired type (int, float, string , ...).
without generics we can implement generics issue, such above.
now, why we shoud use generics and shoudn't use the discussed method ?
Best wishes
|
|
|
|
|
mehrdadc48 wrote: without generics we can implement generics issue, such above.
No, we can't.
mehrdadc48 wrote: now, why we shoud use generics and shoudn't use the discussed method ?
Well, because otherwise we can't have typesafe containers or other classes/methods that can vary by type.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
i have the following piece of xml file
<customers>
<customer name="fred" country="US">
<profession>engineer</profession>
<age>35</age>
<level>5</level>
</customer>
<customer name="heath" country="UK">
<profession>Doctor</profession>
<age>45</age>
<level></level>
</customer>
</customers>
i just ask how to parse this little xml file with c# code
once the xmltextreader standed on customer i need to retrieve information of each customer separately .
how can i do this please
Human knowledge belongs to the world.
|
|
|
|
|
Hi
Do you need to upadte Xml or only have to read the xml ?
What is the size of xml if size is big then use xmlReader else you can use DOM object Google for xmlTextReader or reader
try
{
XmlTextReader reader = new XmlTextReader(strUrl);
while (reader.Read())
{
switch (reader.NodeType)
{
case XmlNodeType.Element:
Hashtable attributes = new Hashtable();
string strURI= reader.NamespaceURI;
string strName= reader.Name;
if (reader.HasAttributes)
{
for (int i = 0; i < reader.AttributeCount; i++)
{
reader.MoveToAttribute(i);
attributes.Add(reader.Name,reader.Value);
}
}
StartElement(strURI,strName,strName,attributes);
break;
//
//you can handle other cases here
//
//case XmlNodeType.EndElement:
// Todo
//case XmlNodeType.Text:
// Todo
default:
break;
}
}
catch (XmlException e)
{
Console.WriteLine("error occured: " + e.Message);
}
|
|
|
|
|
I have created a text editor. I created my own filetype for its documents. But when i double click on one of the documents, it just opens a blank one, instead of reading the one double clicked on. It is an MDI form container, one that is main, and all the children are forms with a rich textbox. Currently the only way to open a file is through the open file dialog, by reading all the lines, and setting the rtf of the rich text box as the rtf of the file. I want to know specifically how to open the files by double clicking. So in general, how do i find out the filename of the document double clicked, so i can tell the file to open on startup? (C# .NET 2005).
|
|
|
|
|
The filename is passed as a parameter into your program, so your static void main should take a string[] as a parameter, and it's in there.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
can you please give more specifics, i have seen that before, but i don't know how to get the filename from using that. Please give some code example, i am a noob and have only been coding for a few months.
Say it takes the parameters string[] args. When i tell it to open the file from the filename args[0], it throws an error.
|
|
|
|
|
TheBirdman99 wrote: When i tell it to open the file from the filename args[0], it throws an error.
Verify that the filename is being passed through, then check the error. Start with a messagebox to show the values in the array, then you know what you're working with.
What error ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
the error was from the try and catch open metheod. it tries to open the file from the specified filename and then make the rich text box's rtf the same as the files.
i used a for loop to show a message box for each part of string[] args. it showed the file path, but it was split up into four different message boxes. is there a way to combine them all to one string to get the complete path?
i tried using a new string as the full path, but when i use += for each part, the location of "Documents and Settings" becomes "DocumentsandSettings" with no spaces because they were in differnt parts of the array.
|
|
|
|
|
You can use Path.Combine ( in System.IO ) to combine all the strings, but you have to do it a pair at a time.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
thank you so much!! i got it to finally work. i realized that the message boxes broke at every space, so i told it to add a space after each part like this.
static void Main(string[] args)
{
string fullFileName = "";
for (int i = 0; i < args.Length; i++)
{
fullFileName += args[i] + " ";
}
Application.Run(new Form1(fullFileName));
}
|
|
|
|
|
Sorry, but this is wrong.
You must tell Windows to pass the entire path name as one object;
whatever else you try will take unnecessary code, that will eventually fail on
special cases (e.g. a path containing two consecutive spaces).
The easiest way is to specify "%1" rather than %1 in the registry entries that you
created to link the file extension (or the Explorers "open with myApp" menu item) to your app.
After doing so, Environment.GetCommandLineArgs[1] will yield the complete file spec
of the first file you double clicked or selected for "open with myApp".
Luc Pattyn
|
|
|
|
|
alright, so i changed %1 to "%1" instead, but can you please tell me why the compiler wont let me do:
string fullFileName = Environment.GetCommandLineArgs[1];
it says
" Error 1 Cannot apply indexing with [] to an expression of type 'method group' "
|
|
|
|
|
i did this instead:
string[] temp = Environment.GetCommandLineArgs();
string fullFileName = temp[0];
it seems to work on double clicking a document and opens a blank one like it should when the .exe file is opened. However, when i run it in debug mode in visual C# 2005 express, it opens the vshost.exe and the text of the document becomes "MZ". is this natural, and also, am i doing everything you said correctly? thanks for your help.
|
|
|
|
|
Yes, you should ignore the string at index 0, since that is pointing to your exe
(indeed, with .vshost inserted in case of Studio 8.0);
so your file name(s) is/are at indexes 1 upwards.
Luc Pattyn
|
|
|
|
|
Sorry, my mistake should be Environment.GetCommandLineArgs()[1]
Environment.GetCommandLineArgs is a method that returns a string array, and you
probably want (at least) the element with index 1.
Regards.
Luc Pattyn
|
|
|
|
|
when i use the index of [1] my computer freezes and visual c# tells me that the error was because [1] was outside of the bounds of the array.
i just built it instead of ran debug and double clicking on a document works fine, but once again, when ran in debug, the same error came up, so should i put an if statement to check the length of the array?
|
|
|
|
|
OK, here is the full story:
execute
string[] args=Environment.GetCommandLineArgs();
and you will get a string array with at least 1 element.
Ignore args[0], it is the path of the exe itself (with the vshost remark).
If you started without anything special, there wont be any more args.
If you somehow specify a command line with real arguments, then the array args will hold
more elements, they each represent a real argument, such as
file paths entered thanks to the "%1", but it could be other things, e.g.
when you start from inside a DOS console, or you use the Visual textbox that lets
you specify command line arguments. So you may need your own command line conventions,
maybe you want to support switches starting with a slash and/or starting with a minus, etc.
This should get you going...
Luc Pattyn
|
|
|
|
|
Thanks for all the help Christian Graus and Luc Pattyn. I really apreaciate it!
|
|
|
|
|
I have got a software package from company with some .dll files in bin folder of the software.
How can I view those .dll files in Visual Studio editor? If someone can help me that would be great.
Haseeb
|
|
|
|
|
helpfulguy wrote: How can I view those .dll files in Visual Studio editor?
Drag and drop the DLL onto the Visual Studio window. However, you won't get to see much. Just some version information.
A much better tool is Lutz Roeder's Reflector[^]. It will take a .NET dll and reverse engineer it so you can see something that looks similar to the original code.
|
|
|
|
|
Thanks man!!!!
also can I ask one more thing:
what book do you recommend to learn C# 100% and how much time do I need to master it?
Haseeb;)
|
|
|
|
|
helpfulguy wrote: what book do you recommend to learn C# 100% and how much time do I need to master it?
If by C# you include the .NET Framework then no book covers it 100%.
It also depends on what you mean by "master" it. I've been writing C# for 5+ years now and I've not got 100% knowledge. However, I've got the next best thing: I know how to looks stuff up on MSDN and how to use an internet search engine.
|
|
|
|