|
If you go to windows explorer and choose Tools>Folder Options>File Types (Tab) you can scroll down and see the mapping for .txt files. If you investigate the "open" option for txt files you will probably see a command like this:
C:\WINDOWS\system32\NOTEPAD.EXE %1
Notice that windows sends the name of the txt file as the first command-line argument to Notepad.exe.
Presumably, notepad looks for this first argument on the command line and tries to open a file at that path in the editor. You should do the same with your program.
|
|
|
|
|
what is the difference between "using" a name space and adding
a dll as a reference
TIA
|
|
|
|
|
simple, using provides you the posibility to avoid writing for every componenet of System.Windows.Forms for exemple every time you have the need
exemple
<br />
System.Windos.Forms Form = new System.Windos.Forms.Form();<br />
if you use an "using" tag you won't have to write the full namespace
and adding a dll as a reference provides you a new namespace
I hope you understand...
By the way... visit http://nehe.gamedev.net[^]
|
|
|
|
|
thanks for responding. going further...
in this example - if i add a reference to an empty solution,
System.Windows.Forms. then in my empty form i have
using System;
using System.Data;
.
.
TextBox tb = new TextBox(); <<- this code will fail complaining of
no directive or assembly.
if i have using System.Win... Form; and no Reference to System.W....Form
under References. the same code will fail.
why do i have to enter the reference twice - once using and once adding
a reference?
thanks
|
|
|
|
|
Just think that you added one .dll file into your solution. Now this .dll file is common or visible to all files avilable in your solution. Once it is added to our reference folder then it is upto you to desided where to use the file.Suppose if you want to use this then explicitly you need to use the keyword 'using' to get that .dll reference there in that perticular .cs file.
To be consize, suppose if you want to use an external .dll then microsoft strictly ensure that the reference must be there in your application. And where to use and where not, that purly depend on us to decide.
Sreejith Nair
[ My Articles ]
|
|
|
|
|
sreejith ss nair wrote:
Suppose if you want to use this then explicitly you need to use the keyword 'using' to get that .dll there in that perticular .cs file.
Thats not true. I can add an assembly as a reference and use the classes within it without ever using a using in the cs file. For example, say I want to use a MyClass in MyAssembly within a namespace called MyNamespace. I add the reference to MyAssembly and then I can throughout the code put things like MyNamespace.MyClass mc = new MyNamespace.MyClass();
sreejith ss nair wrote:
if you want to use an external .dll then microsoft strictly ensure that the reference must be there in your application
That's also not true. See the various Load methods in System.Assembly[^] which allow you to load an an assembly at runtime that wasn't referenced at compile time.
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
what is the difference between "using" a name space and adding
a dll as a reference
This is what the question that the submitter asked. Just think if that person want to ask this question, then how much experience that he have in .NET.
So according to me, we need to feed little amount first. Then little more next etc .
That's why i wrote like that. What ever you pointed is correct. But think , is this will digest for newbees.
anyhow thanks for your comment.
Sreejith Nair
[ My Articles ]
|
|
|
|
|
sreejith ss nair wrote:
we need to feed little amount first. Then little more next etc .
sreejith ss nair wrote:
But think , is this will digest a newbee
I see your point on the first part (about needing to reference an assembly in order to use it), but for the second part... Well, if you look at code generated by the designer you will see that it puts in the full namespace, and if you are adding SqlConnections/SqlDataAdapters and the like you'll notice it doesn't add using System.Data.SqlClient at the top of the file. This can actually be rather confusing to someone who doesn't know both ways as newbies are likely to be relying on the designer more than others and when they come to do some code of their own (in the class that the designer built) they will wonder why they cannot get some code to compile because they don't have a using at the top, but the object already exists in the class somehow...... And the whole thing swirls round in a mess in their head making them more and more frustrated because they can't figure it out.
I see your point about helping them push their knowledge forward in small steps.(They've got to learn to walk before they can run). But, I don't think (partially) misleading assertions help. I would say the better way would have been to say something like "there are other ways, but the more common and useful is...." (or something like that, depending on the situation).
Anyway, don't feel too bad. I'm now likely going to be critisised for being a hypocrit because sometimes I rush a response and make partially misleading statements in order to answer their immediate query, but not give a proper explanation of the whys and hows.
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
Colin Wrote:
Anyway, don't feel too bad.
Colin this not a matter of feeling bad or something. This what helping others. So don't worry i am not at all feeling bad.
Sreejith Nair
[ My Articles ]
|
|
|
|
|
Too much info is always preferable to incorrect info, no?
|
|
|
|
|
i am trying to find this System.Assembly. where is it?
thanks
|
|
|
|
|
If you click the link in my previous message you will get the documentation to it. System.Assembly[^]
Do you want to know more?
Vogon Building and Loan advise that your planet is at risk if you do not keep up repayments on any mortgage secured upon it. Please remember that the force of gravity can go up as well as down.
|
|
|
|
|
i see... that makes sense. thanks very much
i made a reply before reading this . please ignore.
|
|
|
|
|
Reference is to an assembly (dll). An assembly can contain multiple namespaces. using says that you're using a particular namespace withing an assembly.
« Superman »
|
|
|
|
|
Can anyone help me with this please?
public IEnumerator GetEnumerator()
{
return (IEnumerator)this;
}
It's giving me the an unhandled exeption error that says :Specified Cast is not Valid.
I am implementing this method in a class called PartList.
Please I need urgetn help. I need to submit this program in about an hour.
Thanx in advance,
A Newbie in Tha Block
|
|
|
|
|
I wrote an article for CP in IEnumerator and IEnumerable.Please go through that article, You will get a clear picture that what you need to do.
Sreejith Nair
[ My Articles ]
|
|
|
|
|
I’m not entirely sure what your trying to do but if you want to see the contents of an ArrayList for example the code would be something like this. (I’m not compiling this so it may have a syntax error or two but you'll get the idea)
ArrayList ai = new ArrayList();
ai.add(“Hello”);
ai.add(“world”);
IEnumerator _E = ai.GetEnumerator();
while(_E.MoveNext())
{
Console.writline(_E.current.ToString());
}
MSDN link is really good help too http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemiotextreaderclassreadblocktopic.asp[^]
Ronald Hahn, CNT - Computer Engineering Technologist
New Technologies Analyst
HahnTech Affiliated With Code Constructors
Edmonton, Alberta, Canada
Email: rhahn82@telus.net
|
|
|
|
|
In WebService, The WebMethod run normally, and return data success.But When WebApplication run the WebMethod, Error has "There is an error in XML document (421, 39)". may it what cause? How to do it?
|
|
|
|
|
your problem is simple : you have an error (bug) on the web server (an uncaught exception maybe)
maybe the application doesn't call the webmethod you think...
try debugging your web application from begin to end and find out where the exception ocurs and how to avoid it
I hope you understand...
By the way... visit http://nehe.gamedev.net[^]
|
|
|
|
|
Given an int variable k that has already been declared , use a while loop to print a single line consisting of 97 asterisks. Use no variables other than k .
or this....
Given an int variable n that has already been declared and initialized to a positive value , and another int variable j that has already been declared , use a while loop to print a single line consisting of n asterisks. Thus if n contains 5, five asterisks will be printed. Use no variables other than n and j .
Any ideas. I have lots of questions like this. I just need help with one of them so I can work with the rest!
Thanks in advance.
|
|
|
|
|
First, welcome as a new member to CP. This would be better to be asked in the Visual C++[^] forum since you are asking for C code. This forum is for C# questions.
Steve Maier, MCSD MCAD
|
|
|
|
|
Thanks... I am moving it over.
|
|
|
|
|
Logic is same whether it is c or C#. here i am writing example using C#. Try to use correct syntax in c for printing and reciving variable in c while using this logic.
using System;
namespace ConsoleApplication1
{
class Class1
{
[STAThread]
static void Main(string[] args)
{
int n=5;
for(int i=0;i < n;i++)
{
Console.Write(" *");
} Console.Write("\n");
}
}
}
Sreejith Nair
[ My Articles ]
|
|
|
|
|
Do we have to smack you? Make suggstions and point her in the right direction! Don't write the code for her! How is she going to learn anything if your doing her work for her?
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi all
I realise this is probably the most basic C# question I could ask, so apologies in advance, but I have searched everywhere and just can't seem to find a complete answer, all in one place.
I have a class called Donor. Inside Donor, I have properties such as Name, Address, Telephone, etc, but I would also like a collection of Donation classes.
The Donation class has properties such as Date, Amount, MethodOfPayment, etc.
So, I have a Donor class and a Donation class. And I would like my Donor class to contain a collection of Donation classes, which can be added to, removed from, and iterated around using foreach.
Could someone show me the basic steps I need to go through in order to achieve this, or point me in the direction of a good example that encompasses this problem.
Many thanks
M
|
|
|
|