|
Goahead
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Did you register your assemblies (dll) in C:\WINNT\assembly folder (for WIN 2K)??
If yes, you have to again regiter the dll files in the assembly, every time you change them.
CNU
|
|
|
|
|
I am writing private assembly.
The dll is just for the application use.
In fact, can the application run regardless the version of the dll?
|
|
|
|
|
Yes...it is very much possible. As far as my knowledge goes, the version comes into picture only when you register the dll in assembly (correct me if I'm wrong).
It seems there could be some other problem. Why don't you put the error message here (that comes in your output window) ?? Or put a try catch block where your refer the dll's methods and print the exception...
Cheers
CNU
|
|
|
|
|
ting668 wrote:
So, can we ignore the version of the dll so that the application can be run without the runtime error?
You can try, but something is bound to break, if you break the interface. I suggest you create some interfaces and use them rather than the implementation classes. This will ensure you or someone dont go and break it.
top secret xacc-ide 0.0.1
|
|
|
|
|
There are two ways that you can deal with the versioning issue.
The first is to manually manage your version numbers. This is done via the AssemblyInfo.cs file. When the version value is 1.0.* the * tells the compiler to increment with each build. Making it fixed: 2.5.0.0 for example, makes it a fixed version number. The problem is that a developer can make a breaking change and not reflect it since they forgot to change version number.
The second approach is to use reflection to load the assembly. Doing something similar to this: (untested code written off the top of my head)
string ObjectName = Path.Combine(dllPath, dllName);
Assembly container = Assembly.LoadFile(ObjectName);
Type object = container.GetType(objectNamespace);
object.InvokeMember(methodName, blah blah blah)
You can load the dll regardless of version. But you are now doing it all late binding which is TERRIBLY slow. I highly recommend you not consider doing this method.
This signature left intentionally blank
|
|
|
|
|
Thanks~
I try it. However, the third statement
Type object = container.GetType(objectNamespace);
throw exception.
|
|
|
|
|
Hi,
I have developed 2 apps, AppA and AppB.
AppA is a TCP Client
AppB is a TCP Server
When AppB receives a msg from AppA, it will update the view. If I update a TextBox, Label or ListView, it works fine. However, if I update a TreeView (add a new TreeNode), it throws an exception that asks me to use Invoke or BeginInvoke.
Why it just doesn't work on TreeView? and Why using Invoke/BeginInvoke can solve this problem?
thanks
|
|
|
|
|
I think you problem comes from a mistake in your code, maybe if you show us a litle piece of the code (the "update" process you mentioned) maybe we can help you.
I hope you understand...
|
|
|
|
|
Controls should not be modified directly from another thread. Use Control.Invoke to dispatch the function call into the UI thread.
top secret xacc-ide 0.0.1
|
|
|
|
|
Hi,
what if somebody is updating the view from AppB(the server) directly and at the same time, AppA(the client) is asking AppB to update.
(what i meant "update the view" may just be sth like textBox1.Text = "blah" or treeView1.Nodes.Add("blah") )
Can Control.Invoke handle this case?
thanks
|
|
|
|
|
Hello friends
I create a windows forms user control and put a panel inside. Then I build a project and I get the usercontrol from the toolbox and put in a new form. But the panel does not works as waited in design time... I cannot put controls inside... I have tried with Groupbox and Tabcontrols, and doesn't works too.
What I can do to can add controls in design time? In runtime I know what I can use the "Controls.Add", but I wish this in design too
I thank in advance ay help
Regards
|
|
|
|
|
hi,
private void Form1_Load(object sender, System.EventArgs e)
{
//sample user control
UserControl1 sr=new UserControl1();
//adding user control to your main form
this.Controls.Add(sr);
//creating one button
Button btn=new Button();
//changing back color
btn.BackColor=Color.Red;
sr.Controls[0].Controls.Add(btn);
}
Here you have a form with user control. If you want to add controls inside the user control which contain some groupbox or panel.Then you can refer the control (group or panel ) using there index.
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
Thank you sreejith
But your sample code work in runtime only...
Imagine:
1) If you drag a Panel from toolbox to your form (in design), you can add other controls to this panels, simply dragging a label, button, etc, inside of this Panel.
2) But if you create a User Control with a panel inside. We will call "UserPanelControl". Now you drag this usercontrol from toolbox in the form. The Panel what is inside of our UserPanelControl is unable to receive dragged controls from VS.Net IDE (like labels, buttons) inside....
Regards
|
|
|
|
|
Consider the following codes
using System;
namespace ConsoleApplication1
{
interface IPointD
{
double X {get; set;}
double Y {get; set;}
}
struct PointD : IPointD
{
private double x;
private double y;
public PointD(double x, double y)
{ this.x = x; this.y = y;}
public double X
{
get { return x; }
set { x= value; }
}
public double Y
{
get { return y; }
set { y = value; }
}
}
class Class1
{
static void Method(IPointD point)
{
if (point != null)
{
point.X = 10;
point.Y = 10;
}
}
[STAThread]
static void Main(string[] args)
{
PointD point = new PointD(1, 1);
IPointD dPoint = (IPointD)point;
Method(dPoint);
Console.WriteLine("X = {0}, Y = {1}", point.X, point.Y);
Console.WriteLine("X = {0}, Y = {1}", dPoint .X, dPoint.Y);
}
}
}
Why is the dPoint modified, but "point" is not in the call to Method?
Does the cast
IPointD dPoint = (IPointD)point; creates a copy of the "point"?
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
Because point is an object of structure and dPoint is an object of interface
The difference is Structure are by value and class/interface object are by reference.
In C#, classes and structs are semantically different. A struct is a value type, while a class is a reference type.
Sanjay Sansanwal
www.sansanwal.com
|
|
|
|
|
Thanks for the response.
I understand the basics of structs and classes in C#, so this does not really answer my question.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
Paul Selormey wrote:
Why is the dPoint modified, but "point" is not in the call to Method?
Interfaces provide a binding contact, thus the object inheririting from the interface is required to implement whatever the interface defines. This is what allows your cast above to IPointD to succeed. dPoint is simply making its calls through your point object. Does this make sense?
- Nick Parker My Blog | My Articles
|
|
|
|
|
Thanks for the response and the information. Yes, it makes sense.
I got this from the dotnet newsgroup, which confirms what I was suspecting:
Yes. IPointD dPoint = (IPointD)point; -> causes boxing (because point is
value type and it is assigned to an interface type), which acutally makes a
copy of point variable on to the managed heap. The copy is then referenced
by dPoint.
My problem was, since the PointD actually implements the IPointD , boxing should not occur there.
Best regards,
Paul.
Jesus Christ is LOVE! Please tell somebody.
|
|
|
|
|
Hi all,
I have 3 ArrayList, each of them stored some string color name, I want to ask how can I check any duplicated strings between them?
Ofcourse, I can load all strings from one arrayList, and then use ArrayList.Contains(string) to check. however, any fast way to check this ??
Can I only use ArrayList.Contains() to compare with other ArrayList directly?
Thanks for help~~
|
|
|
|
|
hi,
ArrayList impliments few interfaces like IList,ICollection,IEnumerable,ICloneable by default. Suppose if you want to compare
the element of arraylist you need to impliment IComparer interface. This contain one abstract method called Compare.
**************************
S r e e j i t h N a i r
**************************
|
|
|
|
|
azusakt wrote:
however, any fast way to check this ??
If you want fast lookups and have unique elements, I suggest you use a Hashtable instead
top secret xacc-ide 0.0.1
|
|
|
|
|
azusakt wrote:
I have 3 ArrayList, each of them stored some string color name, I want to ask how can I check any duplicated strings between them?
first off - why do you have 3 arraylist which seem to be related to eachother - wont 1 suffice?
azusakt wrote:
Ofcourse, I can load all strings from one arrayList, and then use ArrayList.Contains(string) to check. however, any fast way to check this ??
Can I only use ArrayList.Contains() to compare with other ArrayList directly?
you might consider changing your datastructure to something that provides constant time mechanisms.. an arraylist is basic - some of the operations performed on it - (i think ) are not necessarily constant time complexity. how about something that using a hashing function of some sort ? like for example if you were to have 3 hashtables you could simply do a containskey which is constant time on thme ...
you might want rethink what you are doing though - can you suffice with just 1 and then pass a reference to the remain parts of your program that require this datastructure?
Danny!
|
|
|
|
|
Hi,
I'm writing a C# windows forms application. I've a strange problem in this. Some times, I'm not able to close my appl in the following ways :
1. by clicking on the close button of the form.
2. by clicking on the tool bar button, which calls this.Close();
3. by clicking on the Close option on the menu which you get when you right click on the taskbar/application's icon.
In other words, the only way I could close the application is by terminating from the task manager. This makes me crazy. Please help me...
Cheers
CNU
|
|
|
|
|
Are you running any thread or anyother process in your form? Its seems your form is busy waiting for someother process to complete
Sanjay Sansanwal
www.sansanwal.com
|
|
|
|