|
This is a problem
How can I tell the client to modify?
Here is Common object code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.ComponentModel;
namespace REWFComm
{
public delegate void MessageHandler(string myStr, object sender);
public interface ICommon
{
void Message(string passed, object sender);
event MessageHandler MessageEvent;
}
public class Messages : MarshalByRefObject
{
public void MessageArrived(string myStr, object sender)
{
From HERE I need to tell to client to modefy the control
}
}
}
|
|
|
|
|
Hi,
what you need is a remoting callback. I am not familiar with it, but there are several articles
here on CP that deal with it, this is one of them.[^]. It all starts with a delegate, as usual...
|
|
|
|
|
Thanks for link. but still I have blackout (((((
Any suggestions?
Thanks a lot
Ilan
|
|
|
|
|
Ok here's what I'm trying to do:
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.Reflection;
using System.Runtime.Remoting;
using System.Drawing;
using System.Windows.Forms;
namespace GetConstructorTest
{
public class GooConsistency
{
public GooConsistency()
{
}
}
public class Monster
{
public Monster()
{
}
}
public class GooeyMonster: Monster
{
public GooeyMonster(GooConsistency gooness)
{
}
}
public class SqueltcheyMonster : Monster
{
public SqueltcheyMonster(Color tongueColor, bool isBackflipping)
{
}
}
public partial class Form1 : Form
{
public Form1()
{
object[] MonsterData1 = new object[] { new GooConsistency() };
Monster Monster1 = CreateMonster("GooeyMonster", MonsterData1);
}
public Monster CreateMonster(string type, Object[] vConstructorArgumentValues)
{
Type[] argtypes = Type.GetTypeArray(vConstructorArgumentValues);
Type t = Type.GetType(type);
ConstructorInfo info = t.GetConstructor(argtypes);
return info.Invoke(vConstructorArgumentValues) as Monster;
}
}
}
But on the line: ConstructorInfo info = t.GetConstructor(argtypes);
I get this exception:
System.NullReferenceException was unhandled
Message="Object reference not set to an instance of an object."
Source="GetConstructorTest"
StackTrace:
at GetConstructorTest.Form1.CreateMonster(String type, Object[] vConstructorArgumentValues) in G:\Portable Documents\Visual Studio 2008\Projects\GetConstructorTest\GetConstructorTest\Form1.cs:line 50
at GetConstructorTest.Form1..ctor() in G:\Portable Documents\Visual Studio 2008\Projects\GetConstructorTest\GetConstructorTest\Form1.cs:line 44
at GetConstructorTest.Program.Main() in G:\Portable Documents\Visual Studio 2008\Projects\GetConstructorTest\GetConstructorTest\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Why?
|
|
|
|
|
Probably Type.GetType(type) returned null , that's why t is null as well.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi,
as the exception says, you have a null reference; there is only one reference on that line, so t is null.
reason seems to be you did not specify the full type name in the line above.
MSDN on Type.GetType() says "typeName can be the type name qualified by its namespace or an assembly-qualified name that includes an assembly name specification."
|
|
|
|
|
Hi,
Can you please give me a practical example to distingish below two methods..
Method 1
string.Format("something","Something");
Method 2
string.Format(CultureInfo.CurrentCulture,"something","Something");
Thanks!
Charith Jayasundara
|
|
|
|
|
Your first example simply calls your second example but with null as the first parameter. The second example exlicitly uses the current culture to render the formatting. In other words, if you ask it to format a number it will place the delimiters and decimal markers in the correct place and with the correct characters. For example, if your culuture is set to EN-GB then 1.234 will be rendered, whereas if your culture is NL-NL the same number would be rendered as 1,234
The .NET documentation has extesive examples of how to use Format and on formatting in general, that should be your starting point.
|
|
|
|
|
Hi,
Thank you for the reply. I understand how it works for numbers. But what is the purpose of setting the culture for normal strings?
Charith Jayasundara
|
|
|
|
|
Charith Jayasundara wrote: But what is the purpose of setting the culture for normal strings?
Because some people like consistency and will set all parameters explicitly all the time. Other than that, I don't think it makes any difference for strings.
|
|
|
|
|
Great
Thank you!
Charith Jayasundara
|
|
|
|
|
I have a table defined in a xsd that has an autoincrementing field that is used as the key to the table. The application uses ReadXML and WriteXML function to persists the dataset to an XML file. I am curious as to where the next value to use for the autoincrement field is persisted. I would have expected that when creating a new row in the table, the value for the ID field would be one greater than the highest value found in the table after the dataset is read in. It seems however to persist the highest value used in the past, even if those records have been deleted. In my application, when I create a new row, the ID field contains a 6071 when the highest value used before creating a new row was 5995. It does not appear that the autoincrement seed value is stored in the XML file itself, but where else would it be.
|
|
|
|
|
Hello everyone,
I am writing a backend program which will upload some big files to another server and I want to detect whether current machine's network is busy or not (I want to use relative non-busy time of current machine to upload files, as I do not want to impact other network related task on the machine as the upload file task priority is low).
Does anyone have any idea about how to check whether current machine is busy with network I/O? Should I check some performance counters?
thanks in advance,
George
|
|
|
|
|
George_George wrote: Does anyone have any idea about how to check whether current machine is busy with network I/O?
You can try it with WMI . I think WMI will helps you out.
cheers,
Abhijit
|
|
|
|
|
Thanks Abhijit,
Do you have more detailed advice? Which API from WMI should I use?
regards,
George
|
|
|
|
|
I think You can Download "WMICodeCreator " , and can explore it.
cheers,
Abhijit
|
|
|
|
|
Thanks Abhijit,
I have downloaded the WMICodeCreator. But it is just a tool to list all WMI classes. There are a couple of network and network adapter related classes/properties. Which one should I use?
regards,
George
|
|
|
|
|
When you will select the classes, you will get corresponding properties that are available. And will get the code in right pane, Change the language to C# from Tool.
BTW: Check Senthil post also.
cheers,
Abhijit
|
|
|
|
|
Thanks Abhijit,
I noticed a lot of similar ones related to network and network adapter. As a newbie for this topic, I need exact information about which item should I use.
Any comments or ideas?
regards,
George
|
|
|
|
|
|
Senthil, Thats a good link !!!
cheers,
Abhijit
|
|
|
|
|
Agree, Abhijit.
But I have to use Windows Server 2003.
regards,
George
|
|
|
|
|
Sorry, Senthil.
I work on Windows Server 2003. Any solutons for this platform?
regards,
George
|
|
|
|
|
how can i load the data from data base table to my form
and show the data in text boxes without using the wizard
and how can I move between the rows
|
|
|
|
|
Please Search Google , Before Post Here.
Any way , there are few goods articles on Code Project it self, Hope This will helps you !!
Ref1[^]
Ref2[^]
cheers,
Abhijit
|
|
|
|