|
dashingsidds wrote: My question here is, is it possible to avoid giving the reference of the 1st project in the 3rd project and still avail the above functionality?
No. Unless you use a web service to expose your first project. You would then be generating a proxy for your this class in wherever you want to consume your web service.
My signature "sucks" today
|
|
|
|
|
dashingsidds wrote: Now when i want to use the above method in my third project i.e. in "UseMethod" I have to give the reference of both the projects 1 and 2 in the 3rd project if I want to use it as follows.
public void Test()
{
UseDefinedEnums(MyEnum.value1);
}
My question here is, is it possible to avoid giving the reference of the 1st project in the 3rd project and still avail the above functionality?
Hi Samar,
You can't do it as you are using both the two projects inside the third one. You must have to add the reference of the two projects in the third one.
Don't forget to Click on [Vote] and [Good Answer] on the posts that helped you.
Regards - Kunal Chowdhury | Software Developer | Chennai | India | My Blog | My Tweets | Silverlight Tutorial
|
|
|
|
|
This is analogous:
here is a method that calculates the square of a number:
public static Number Square(Number aNumber) {...}
now start using it.
BTW I will not tell you what Number is.
You should see immediately it can't be done, how can you use something when it relies on stuff that is not available?
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Hi Luc,
I get your point here but i think you misunderstood me a little.
I know it is not possible to get a class which is not present anywhere in the project or in the referenced assemblies.
What I was thinking here is, if possible, we can build a wrapper class in the second project which will expose the methods in the first project. In this way the second project's assembly will contain the methods of the first assembly as well and hence need not give an explicit reference of the first project in the third project. The problem here is i am unable to figure out how am i going to do that???
I hope u r getting me here. If this is not possible then i am willing to leave trying this.
Regards,
Samar
|
|
|
|
|
in your example, the method of the middle DLL was using a type from the first DLL as a parameter, hence that type had to be available to the final EXE.
if none of the public API of DLL 2 needs types from DLL 1, then of course your EXE would not care about DLL 1 itself, as all it sees is the public stuff of DLL 2. The EXE is not interested in how DLL 2 is implemented, nor what it may need internally. That is normal when using libraries, packages, etc.
Example: when I use a WebBrowser, it relies on several DLL (I admit, those probably are unmanaged) thast belong to Internet Explorer; my app does not need to know any detail, as all the API parts of WebBrowser are regular .NET types.
So you can wrap methods; you can hide classes and types in general. But you cannot actively use classes/types without knowing them.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
So Luc you are saying there is no way i can refer the methods or classes from the 1st project in the 3rd project without referencing it??? Not even by creating a wrapper class or something in the second project and then using that wrapper class in the third project?? Hmm.. A little hard to believe, for me atleast..
Thanks a million for your time and help Luc.
Regards,
Samar
|
|
|
|
|
dashingsidds wrote: So Luc you are saying there is no way i can refer the methods ...
That is not what I said; you can refer everything that is public as long as you know all the types required to access it: the type that contains the method, the parameter types and the return type.
If I sell you a graphics package and deliver one DLL, you can use it by adding a reference to it in your project, and referring to whatever is public.
When I release a version 2, I may have split the DLL in seven DLLs; as long as one of them still has the original name and makes the original types available, for you nothing has changed. How things are organized amongst those seven DLLs is of no concern of yours. What I should not do, is migrate a public type from the original DLL to some other DLL though; if I did that, you would need a reference to access that type.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Hmm... I got that. So how do I apply the thing you just said in my scenario??? Or what do I need to change to make this work???
Please note that in my case creating 2 assemblies is inevitable. Also I cannot provide more than 1 assembly to the client.
Please advice.
Regards,
Samar
|
|
|
|
|
Hi All
I downloaded a library to compress files into zip archives...
I am now trying to add an event handler (or any other type of handler) that will monitor the progress of the compression.
This is the code to compress the files: (I have marked where I am having difficulty)
using (ZipFile zip = new ZipFile())
{
zip.CompressionLevel = Ionic.Zlib.CompressionLevel.BestCompression;
ZipEntry e = zip.AddFile(ex1);
e = zip.AddFile(ex2);
zip.AddProgress += new ProgressChangedEventHandler(saveProgress);
zip.Save(compressedFile);
}
This is the code to track the changes:
private void saveProgress(Object sender, SaveProgressEventArgs e)
{
switch (e.EventType)
{
case ZipProgressEventType.Saving_Completed:
Console.WriteLine("Save Complete");
sendFile("Compressed/Package.zip");
break;
case ZipProgressEventType.Saving_Started:
Console.WriteLine("Saving Started...");
break;
default:
Console.WriteLine("Saving...");
break;
}
}
I am not sure how to go about adding an eventhandler to the zip to monitor the progress.
Thanks for all those who can assist!
|
|
|
|
|
Could you elaborate a little on what type of error occurs? Is it compilation error or runtime error? What does the error say?
|
|
|
|
|
It is a compilation error:
"No overload for 'saveProgress' matches delegate 'System.ComponentModel.ProgressChangedEventHandler'"
Viewing other examples of eventhandling, I haven't seen any of them adding parameters to the methods they call as the event handlers.
|
|
|
|
|
I didn't use the library you talk about, but the example I found is bit different, than what you supplied: Link[^]. The link I suppliy is documentation of the event handler you want to use. And there event argument is AddProgressEventArgs instance and you use SaveProgressEventArgs. Maybe you attached wrong handler? Or you wanted to attach to a different event (SaveProgress)? Hope this leads you to a solution for your problem.
|
|
|
|
|
Hi Again
I tried the link that you sent and it worked perfectly...
...I then tried the same thing, but with SaveProgress, and it worked too.
So thank you for your speedy assistance, it is much appreciated!
They should have some sort of rating system for rating answers and the people who send them.
Thank you for your time!
Enjoy the rest of the day!
|
|
|
|
|
Actually they have. If you expand my previous answer you should have links "Good answer" and "Bad answer". Click whichever you think is better
|
|
|
|
|
A quick question: can "Microsoft Surface Toolkit for Windows Touch Beta" be used with standard multi-touch devices (like this one: link[^]). Because I haven't found any conclusive answer to this question and don't want to spend cash if I wan't be able to use it. And do I need anything special to use it? Or just standard Windows 7 or Vista will suffice?
Thanks in advance.
|
|
|
|
|
Hi,
Is there any support for graphs in .Net (simple bar, line and dot graphs)? Any examples to use will be good.
Gurpreet
|
|
|
|
|
Have a look at this article.
My signature "sucks" today
|
|
|
|
|
you can use microsoft chart control for graphs in dotnet applications
|
|
|
|
|
Yes. See this[^] link.
/ravi
|
|
|
|
|
protected virtual void Dispose(bool bDisposing)
{
if (bDisposing)
{
// No need to call the finalizer since we've now cleaned
// up the unmanaged memory
GC.SuppressFinalize(this);
}
if(this.m_pNativeObject != IntPtr.Zero)
{
// Call the DLL Export to dispose this class
DisposeNetworkImp(this.m_pNativeObject);
}
}
|
|
|
|
|
Shouldn't the DisposeNetworkImp IF and code go inside the if(bDisposing) block?
|
|
|
|
|
There might be a problem with the "Data Execution Prevention" (DEP). We had lots of problems with a third party component till we were told about that.
Just switch DEP off for a test. If that resolves the problem, you can also prevent DEP for your program by adding a post build action:
call "$(VS80COMNTOOLS)\vsvars32.bat"
editbin.exe /NXCOMPAT:NO "$(TargetPath)"
|
|
|
|
|
I found the error i was creating the object with diff class and trying to delete it with different class destructor the problem was in DLL only.
|
|
|
|
|
How to solve this problem?
System.Data.SqlClient.SqlException: Can not open 'User Management' in the request database. Login failed.
User 'HUIZHI-C02E58FC\liuhanpo' Login failed.
In System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
In System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)
In System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
In System.Data.SqlClient.SqlInternalConnectionTds.CompleteLogin(Boolean enlistOK)
In System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, Int64 timerExpire, SqlConnection owningObject)
In System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(String host, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, Int64 timerStart)
In System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
In System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
In System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
In System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
In System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
In System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
In System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
In System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
In System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
In System.Data.SqlClient.SqlConnection.Open()
In User Management.ChangestaffPwd.button5_Click(Object sender, EventArgs e) Location C:\Documents and Settings\liuhanpo\Desktop\User Management\ChangestaffPwd.cs:Line 137
In System.Windows.Forms.Control.OnClick(EventArgs e)
In System.Windows.Forms.Button.OnClick(EventArgs e)
In System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
In System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
In System.Windows.Forms.Control.WndProc(Message& m)
In System.Windows.Forms.ButtonBase.WndProc(Message& m)
In System.Windows.Forms.Button.WndProc(Message& m)
In System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
In System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
In System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
|
|
|
|
|
Make sure the credentials you are using are valid. Check for typos, uses SSMS to connect using the credentials.
If you are using a restored database you may need to drop and recreate the user in SQL Server.
Never underestimate the power of human stupidity
RAH
|
|
|
|