|
Having two projects inside the same solution does not make them know anything about each other. In order to use the classes, interfaces, etc. of one project, it has to be referenced by the project that wants to use the stuff. Now that the second project knows about the first one, you can access all things declared public in the first project independent of their namespace.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Thank you for your kind and swift reply. I was under the impression that importing a project into a solution automatically meant that they know about each other. Obviously not. However, how can I reference a complete project ( or the namespace for that matter ) into a project.
using CookBook; at the top of the form is still generating the same error during compilation and so is using the complete name ( namespace.class.method ).
|
|
|
|
|
Inside the project explorer right-click on "References" and select the "Add reference..." option. In the dialog that opens that should be a "projects" tab.
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rick Cook www.troschuetz.de
|
|
|
|
|
Try the following way
Rightclick the project->add reference->Project->Select the project
Regards
R.Arockiapathinathan
|
|
|
|
|
Thank you once again for your reply. But adding project A to B , and B to A would create a circular dependency right ?
|
|
|
|
|
Yah, its right.
If this is the case, you have to restructure you projects and create one more project and push the common things into that project and refer that into both projects.
Regards
R.Arockiapathinathan
|
|
|
|
|
Can someone help me telling me how can I convert a element of a list to int?
|
|
|
|
|
You could call Convert.ToInt32(listArray[0].ToString()); . Alternatively, if you're using .NET 2, I would recommend just creating the List as List<int> list = new List<int>();
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Pete O`Hanlon wrote: call Convert.ToInt32(listArray[0].ToString());
Is there any reason why you are calling ToString() ? Convert works on object too... Only meaningful thing I can think of is to provide IFormatProvider , but then again there is Convert.ToInt32 (Object, IFormatProvider) overload.
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
dnh wrote: Is there any reason why you are calling ToString()
Yup - typing in away from a dev box and doing it from memory - I don't tend to use the .NET 1 list anymore.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
"Throughout human history, we have been dependent on machines to survive. Fate, it seems, is not without a sense of irony. " - Morpheus
"Real men use mspaint for writing code and notepad for designing graphics." - Anna-Jayne Metcalfe
|
|
|
|
|
If the list is of int s to begin with, only a cast required.
|
|
|
|
|
Hi,
I'm trying to find all classes that implement a specific abstract base class inside an Assembly, so far I have got the following...
Assembly assm = Assembly.GetExecutingAssembly();<br />
<br />
foreach (Type type in assm.GetTypes())<br />
{<br />
if (type.IsSubclassOf(typeof(MyAbstractClass)))<br />
{<br />
Response.Write(type.ToString() + "<br />");<br />
}<br />
}
...and this seems to work OK. However, my assembly is already fairly large and may grow, and as far as I can tell this code iterates through all types in the assembly, which I feel is inefficient.
I know all my derived classes will sit inside the same namespace, so was wondering if there's a way to iterate through all types inside a particular namespace only, instead of the entire assembly?
Cheers!
|
|
|
|
|
OK, I've had enough and need to ask. I'm looking at some Interop work carried out in .Net 2.
Essentially we have a VB6 application and associated classes, some of which provide Interfaces. As part of a recent project a .Net 2.0 'plug-in' has been developed, which implements a particular Interface from the aforementioned VB6 project. This 'plug-in' is then exposed to com and made accessible back to the aforementioned VB6 Application via Interop, (I know - it's horrible).
The items from the .Net 2.0 plug-in which implement the interfaces are themselves in turn implemented by a menu item in the VB6 application. They're early bound and a specific method is called at start up and at shut down. Event logging in the .Net 2.0 application suggests all of the elements of the call at start up and shut down are run to completion. When the VB6 application is started with the menu item implementing the plug-in attached, a 'Memory could not be "read"' application error is against the VB6 app is caught by the OS, (Windows XP), after application shut down whether you do or do not click the menu item. When the VB6 application is run in debug, the error is thrown when Visual Studio is exited.
Does anyone have any idea what could be causing this?
Cheers,
NB: If the above is confusing or unclear, I can try to clarify
Rhys
"The trouble with having an open mind, of course, is that people will insist on coming along and trying to put things in it"
They say a little knowledge is a dangerous thing, but it's not one half so bad as a lot of ignorance."
Terry Pratchett
|
|
|
|
|
I have populated a dataset with one table.
The data in the table looks as follows:
Index1Name Index2Name City Value
Indexk Indexk city1 2
Indexk Indexk city1 3
Indexk Indexd city1 2
Indexk Indexy city1 1
Indexy Indexk city1 1
Indexx Indexk city1
Indext Indexq city1 5
Indexs Indexs city1 6
Now I would like to have an array which gets populated from the distinct values in columns of Index1Name and Index2Name
So the array should contain something like:
Indexd Indexk Indexy Indexx Indext Indexs Indexq
Thanks
|
|
|
|
|
You can loop thru and write your own logic to fill in the array(s) you like.
Mubashir
Software Architect
Storan Technologies Inc, USA
Every job is a self portrait of the person who did it.
|
|
|
|
|
Hi,
Im using C#.Net 2003,im using windows 2000 operating system.. i retrieved all the available windows user by using the following code and listed in the listbox..
private void button2_Click(object sender, System.EventArgs e)
{
using(DirectoryEntry root = new DirectoryEntry("WinNT://node-10"))
{
foreach (DirectoryEntry child in root.Children)
{
if (child.SchemaClassName == "User")
{
listBox1.Items.Add(child.Name);
}
}
}
}
Actually i want to check is it the right user or not from the C#.Net by programmatically..
in textbox1 im entering the username and
in textbox2 im entering the password
on clicking the ok button it should check whether the entered username and password are the right one or not,if it is the right one, then in messagebox("Valid user") else in messagebox("Invaliduser").and also mention if need to refer any namespaces over here...How should i achieve this one...plz help me..its urgent...
rgrds
Kanna..
|
|
|
|
|
Dotnetkanna wrote: plz help me..its urgent...
I wish I had a dollar for every CP post that ends with that.
Why do you want to do this ? I'd be sad if it were possible to write an app that tells a user on a PC the username and password of all users on that machine. But, why would you require someone to log on using creditials they have already logged on with ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: But, why would you require someone to log on using creditials they have already logged on with ?
I was just thinking that.
|
|
|
|
|
Hi,
Thanks for your reply.I want to check is that particular user is available in that operating system or not.im not going to login.I want jus check is that user is existing or not in the operating system by programmatically.any idea please..
rgrds
Kanna..
|
|
|
|
|
Hi,
Thanks for your reply.I want to check is that particular user is available in that operating system or not.im not going to login.I want jus check is that user is existing or not in the operating system by programmatically.any idea please..
rgrds
Kanna..
|
|
|
|
|
As I said, I'd eat my hat if the system allows you to ask for the passwords of all users. The usernames cannot be hidden, they are written in the Documents and Settings folder.
What you want to do makes no sense, and is unlikely to be supported. Why would you require someone give their password to prove that the system has correctly found their username ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
Actually im doing one process for that i want to check whether the user is exists or not in the operating system..im passing the username and password to this tag,if it is the right user means the program is running well if it is the invalid user means im getting the error..before do that process i want to check whether that user is available or not..for this i want to check this one...
regards
Kanna..
|
|
|
|
|
While I am not sure this will fit what you need I do something similar in one of the applications I develop and you may be able to tweak this.
Basically this application has functionality within it that could feasible be very destructive in the wrong hands. As a result of this I need to ensure that the user sat at the machine is the actual user that is logged on. In order to do this when the application opens it prompts them to enter their windows authentication information.
Internally the code uses the following:
const int LOGON32_LOGON_INTERACTIVE = 2;
const int LOGON32_PROVIDER_DEFAULT = 0;
[DllImport("advapi32.dll", SetLastError=true)]
private static extern bool LogonUser(String lpszUsername, String lpszDomain, String lpszPassword, int dwLogonType, int dwLogonProvider, ref IntPtr phToken);
private void DoLogonCheck()
{
this.logonAttemptCount++;
IntPtr phToken = IntPtr.Zero;
bool logonRes = LogonUser(
txtDomainUserName.Text,
txtDomainName.Text,
txtDomainPassword.Text,
LOGON32_LOGON_INTERACTIVE,
LOGON32_PROVIDER_DEFAULT,
ref phToken);
if (logonRes)
{
this.DialogResult = DialogResult.OK;
this.domainUserName = txtDomainUserName.Text;
this.domainName = txtDomainName.Text;
}
else if ((!logonRes) && (this.logonAttemptCount < this.maxLogonAttempts))
{
txtDomainPassword.Text = string.Empty;
txtDomainPassword.Focus();
}
else if ((!logonRes) && (this.logonAttemptCount >= this.maxLogonAttempts))
{
System.Windows.Forms.Application.Exit();
}
}
Externally to this method the code also checks that the given user name is the same user that is under the Environment.UserName object.
As an additional level of security the form that results from successful authentication has a timeout that will close it after X seconds of inactivity. This means that if the user logs in and then gets up an walks away the application isnt open to any passer by.
In theory I believe that this code could also be used to check the logon for a user that is not currently logged on, however I have never used it that way so I cannot say for certain
|
|
|
|
|
Hi,
Thanks for ur Valuable reply.while im using ur code im getting the error on
this.logonAttemptCount++;
.
.
.
this.domainUserName = txtDomainUserName.Text;
this.domainName = txtDomainName.Text;
.
.
else if ((!logonRes) && (this.logonAttemptCount < this.maxLogonAttempts))
.
.
else if ((!logonRes) && (this.logonAttemptCount >= this.maxLogonAttempts))
Im getting error on these lines as "does not contain definition for 'logonAttemptCount'" and "does not contain definition for 'domainUserName'" and "does not contain definition for 'domainName'"...How to i solve this did i need to add any references other than this
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.DirectoryServices;
using System.Runtime.InteropServices;
using System.Web.Security;
using System.Security.Principal;
If yes, give me the detail and give me a solution to the error..plz
rgrds
Kanna..
|
|
|
|