|
Make a new class library. And compile it.
Then include the library, wich is compiled to an DLL and then use it.
You don't have to use the same namespace.
Niklas Ulvinge aka IDK
|
|
|
|
|
how can i compile a class as a dll?
|
|
|
|
|
I think you'll need to start a new project that's a classlibrary. When you compile it it outputs an dll
Niklas Ulvinge aka IDK
|
|
|
|
|
You can also create a dll manually without using VS Studio, i use notepad and batch files for programming and creating a dll is an easy task:
With explorer browse to the folder where your sources (.cs files) are located (the files that your dll will use) and create a text file with notepad and add the following 2 lines to this new file:
csc.exe /target:library /out:MyLibrary.dll *.cs
pause
Save the file, close it and now rename its extension from .txt to .bat, this is a batch file. Now doble click on it (open it) and it will open a DOS window and will start the compiling process. The first line you added to the file will create your dll and the second will prevent the window to close and it will keep it open so you can see the compiler's output in case something goes wrong.
|
|
|
|
|
hi to all,
i have sifted through the many remoting turoials and come up with this basic implementation to understand the workings .. but ...
i changed the RemoteData (public interface method) contents to reflect that it is on another computer, changed to "server says hello", while the local copy is "local copy".
the server RemoteData object is never called, why is this so? it always returns "local copy" when the client is started.
can someone explain this to me please?
sorry about the code tags, but needed for the xml
-------- the server
<code>
using System;
using System.Runtime.Remoting;
using StationUpdate;
namespace SimpleServer
{
/// <summary>
/// The remoting server
/// </summary>
public class RemotingServer
{
public RemotingServer()
{
}
private static RemoteData rd=null;
static void Main(string [] args)
{
RemotingConfiguration.Configure("SimpleServer.exe.config");
rd = new RemoteData();
RemotingServices.Marshal(rd,"RemoteData");
Console.WriteLine("Press return to exit");
Console.ReadLine();
}
}
}
</code>
-------- the server config
<code>
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application>
<channels>
<channel ref="tcp" port="8000" />
</channels>
<service>
<wellknown mode="SingleCall" type="Remoting.StationUpdate.RemoteData,Remoting.StationUpdate" objectUri="RemoteData" />
</service>
</application>
</system.runtime.remoting>
</configuration>
</code>
-------- the client
<code>
using System;
using System.Runtime.Remoting;
using StationUpdate;
namespace SimpleClient
{
/// <summary>
/// Summary description for SimpleClient.
/// </summary>
public class SimpleClient
{
public SimpleClient() { }
static void Main(string[] args)
{
RemotingConfiguration.Configure("SimpleClient.exe.config");
RemoteData robj = new RemoteData();
Console.WriteLine(robj.Hello());
Console.ReadLine();
}
}
}
</code>
-------- client config -- pesca is anothe host on my LAN
<code>
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.runtime.remoting>
<application name = "SimpleClient">
<client>
<wellknown type="Remoting.StationUpdate.RemoteData,Remoting.StationUpdate" url="tcp://pesca:8000/RemoteData"/>
</client>
<channels>
<channel ref="tcp" port="0"/>
</channels>
</application>
</system.runtime.remoting>
</configuration>
</code>
-------- the remote object
<code>
using System;
using System.Runtime.Remoting.Lifetime;
namespace StationUpdate
{
/// <summary>
/// The remote object
/// </summary>
public class RemoteData : System.MarshalByRefObject
{
public RemoteData()
{
Console.WriteLine("RemoteData Constructor Called");
}
public override object InitializeLifetimeService()
{
return null;
}
public string Hello()
{
//return "server says hello";
return "local copy";
}
}
}
</code>
|
|
|
|
|
i want to know is there any possibility to increase the height of rows of listview control in c# or is there any other customized control on CP that i can use to achieve this purpose.
2nd problem is this i want to add a date time picker control into a column of a list view how can i achieve this plz help me
|
|
|
|
|
Why don't you look at the controls submitted by fellow CPians?
There's even a search function that will lead you to various ListView controls here that are able to do what you want...
mav
|
|
|
|
|
Hi
i need to add an object to crytal report programically . i search msdn and find that can change objects of a report by code but can not find any code to add an object to report
can anyone help me ?
Regards Amir Jalaly
|
|
|
|
|
Can we add a custom expression column to a Typed DataSet to display it in DataGrid? If yes then can you help me with that please? Thanks.
|
|
|
|
|
I have a boolean column in my database and I need my datagrid to show it as a check box insted of "0" or "1". Any ideas how i can do that?
I am using Typed DataSet to populate my datagrid. Thanks
|
|
|
|
|
I am displaying a ComboBox that hopefully contains the contents of a database table (a lookup of sorts). When the form loads, the ComboBox contains the correct values, all sorted.
However, when I try to select a value programitically, I can't (well, I can't select the correct one).
I create a dataset:
DataSet dsTitles = new DataSet("Titles");<br />
SqlCommand tableCommand = new SqlCommand();<br />
tableCommand.CommandText = "select TitleID, TitleDisplayText FROM tblTitles WHERE TitleHidden <> 1";<br />
<br />
SqlDataAdapter adapter = new SqlDataAdapter();<br />
adapter.SelectCommand = tableCommand;<br />
adapter.Fill(dsTitles, "Titles");
I then bind the dataset to the ComboBox:
comboBoxTitle.BeginUpdate();<br />
comboBoxTitle.DataSource = db.DataSetTitles.Tables["Titles"];<br />
comboBoxTitle.DisplayMember = "TitleDisplayText";<br />
comboBoxTitle.ValueMember = "TitleID";<br />
comboBoxTitle.EndUpdate();
So far, all is well. However, I can't seem to select the correct item. I've tried:
comboBoxTitle.SelectedValue = 2;<br />
Console.WriteLine("Current Title Index: {0} Text: {1} Combo Index: {2} Value: {3} Text: {4}", 2, db.LookupValueTitle(2), comboBoxTitle.SelectedIndex, comboBoxTitle.SelectedValue);<br />
TitleID of 2 matches TitleDisplayText of Mr, but nothing is visibily selected.
Current Title Index: 2 Text: Mr Combo Index: 0 Value: 2 Text: is what gets logged.
Any help would be appreciated.
--G
|
|
|
|
|
Hi,
I've just owned an oldie Dual PentiumIII PC for low profile server and specially for programming.
I just want to take advantage of SMP for my apps and dual procs system really takes advantage from apps only if the apps is programmed to support smp. I don't know if there's a sentence that should be added in my code or is a parameter in the compiler command.
How can i add SMP supports in my C# apps?
Thanx.
Heinz Suez
|
|
|
|
|
Rewrite your app to include multithreading support. It's not something that can just be "turned on" with a switch.
Your application must be able to have parts that that run concurrently. For instance, breaking up a problem and having two threads each work on a seperate part of it. Or, in the case of say, a telnet server, one thread handles one client connection and another threads handles another.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Oh, i though it was as simple as turning a switch on with a special syntax in my code or a parameter in the compilation command.
So, you're saying that mi app will automatically detect 2 threads in my code and run each thread with a different processor?
In that case i should play a lot with System.Threading
|
|
|
|
|
No! You have to write your code to support multiple processors! Your code must be written to create it's own threads where appropriate. There is nothing that will do this for you.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Ok, i'll write my own threads inside my code.
System.Threading namespace is the way to go?
Do i have or can i specify wich processor should handle my thread?
|
|
|
|
|
Hi again, i've been surfing the net for a bit help and found code samples referring our topic in intel's site.
They use System.Threading for creating new threads (they have code that uses 4 different threads) but how do i know if these threads are handled by diferent processors? cause in the code they don't specify a processor to handle the thread and there's the possibility that a single proc may be running all the threads, how can i specify wich proc to handle threads?
Or my pc finds a thread and runs it with a processor and when my pc finds a second thread it runs it with the other proc?
Thanks for your help.
Sorry if i'm slow learning.
|
|
|
|
|
Heinz Suez wrote:
but how do i know if these threads are handled by diferent processors?
You don't! The system schedules which processor is going to handle which thread. Threads can even be moved between processors. 99% of the time, you really wouldn't have a reason to manually set the processor affinity. but, if you want to take a look at it, ProcessThread[^] in the System.Diagnostics namespace is what your looking for. Be sure to check out the ProcessorAffinity property.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Thanx man for your help, i got it all clear now.
|
|
|
|
|
Hi
I have a structure similar to this:
<root>
<item />
<eq>
<elems />
<elems />
<elems />
</eq>
<item />
</root>
how can I change it to this:
<root>
<item />
<elems />
<elems />
<elems />
<item />
</root>
I need to move all the children and delete the parent, but i can't figure out how to do it. What do I need to do??
cheers
-- modified at 11:49 Sunday 18th September, 2005
|
|
|
|
|
Please re-post. Cant see anything.
Live Life King Size
Alomgir Miah
|
|
|
|
|
|
|
I have an MDI app with several child forms. The MDI form has a MainMenu control on it. My child forms also have MainMenu controls. By Windows defaults when a child form is opened in the MDI, the childs MainMenu is added to the MDI parents MainMenu.
How can I prevent this? I want the MDI forms MainMenu left alone. I need the child forms MainMenu controls to appear on them and not be merged with the parent MDI.
|
|
|
|
|
Well I found a solution for this. I wrote my own menu control. It works great so far and gives me more enhancement options then the standard Windows MainMenu.
In your face Microsoft standards.
|
|
|
|