|
I have a server that exposes some classes through .NET Remoting.
If these classes have events, can the client subscribe them by simply using the usual syntax Event += new EventHandler(...), after getting a reference to the remote object?
Perhaps I'm asking an idiocy.
___________________________________
Tozzi is right: Gaia is getting rid of us.
My Blog [ITA]
|
|
|
|
|
Yes they can, and that is the beauty of remoting, you can use remote objects just like local ones.
You need to be aware of potential security exceptions though, because when the server fires an event, communication is happening in the opposite direction (when compared to a method call). Specifically, you'd need to set the typeFilterLevel[^] to allow two way communication. And of course, if your client is behind a firewall that blocks all incoming traffic, it's not going to get the events.
Regards
Senthil
_____________________________
My Blog | My Articles | My Flickr | WinMacro
|
|
|
|
|
Thanks for your reply!
S. Senthil Kumar wrote: if your client is behind a firewall that blocks all incoming traffic, it's not going to get the events
I thought that, when you get an instance of the remote object, the network connection is kept open until you destroy it. Am I wrong?
___________________________________
Tozzi is right: Gaia is getting rid of us.
My Blog [ITA]
|
|
|
|
|
Yes, but you need a different socket connection for events, as the role is reversed i.e client becomes server and server becomes client, because it's the server that initiates the call.
Regards
Senthil
_____________________________
My Blog | My Articles | My Flickr | WinMacro
|
|
|
|
|
any one know why the key down don't work?
thanks
|
|
|
|
|
because there is some bug in your code probably. paste us a snippet responsible for that...
|
|
|
|
|
Did you set the forms KeyPreview property to True?
Roy.
|
|
|
|
|
I have an array of bit values - well actually a bool array, 8 elements long. How can I convert this into it's byte representation?
So basically, I want to do a binary to decimal conversion. How can I do this?
/\ |_ E X E GG
|
|
|
|
|
Create a BitArray from the array of booleans and use the CopyTo method to store the value in an array of byte (with the size of one).
---
b { font-weight: normal; }
|
|
|
|
|
OK Thanks. I found a nice library on this site also...
/\ |_ E X E GG
|
|
|
|
|
If it's just an 8-bit to byte conversion this will do the job:
byte value = 0;
bool[] bits = { false, true, true, false, true, false, false, true };
for (byte b = 0; b < bits.Length; b++)
{
value <<= 1;
if (bits[b])
value |= 0x1;
}
This will also work if you change byte to int and increase the array length to a maximum of 32 boolean values
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
ok next q ... how do you access inputs into a constructor
within the base class?
my base class constructor:
protected int commonID; // this is common to all object
public BaseClass{
console.write commonID; // or something that accesses id
}
my sub-class constrictor:
public myClass(int id)
{
commonID = id;
}
but when I instantiate "myClass", before it sets commonID, it goes
to the BaseClass constructor. But commonID is null cause it hasnt
been set.
So is there a way for me to get "id" into the baseclass? or get commonID
set?
M
|
|
|
|
|
Here are your two constructors rewritten:
public BaseClass(int id)
{
commonID = id;
console.Write(commonID);
}
public myClass (int id) : base(id)
{
}
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
dude, that was perfect, it worked.
thanks!
Moazzam
|
|
|
|
|
base class:
protected int commonID; // this is common to all object
public BaseClass{
}
public void DoOtherThing {
console.write commonID; // or something that accesses id
}
///////////////////////////////////////////////
sub-class:
public myClass(int id)
{
commonID = id;
DoOtherThing();
}
Was it a cat I saw?
|
|
|
|
|
But with this code the purpose of having the base class is somewhat lost as your method requires the subclasses to specifically call DoOtherThing() rather than properly inherite the behaviour of the base constructor.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
ADD button is the last control which i click in my page, after I click ADD button if I refreshed the page again ADD buttonEvent is being executed.I don't want this. How to avoid last event from execution when page is refreshed.
Srilakshmi
|
|
|
|
|
I think that's a standard behavior of Internet Explorer so that should be impossible to achieve your goal. But you can put a hyperlink to itself in each page and click it instead of click "Refresh".
Was it a cat I saw?
|
|
|
|
|
Workarounds
1. You can redirect user to someother page after clicking add button. Like "Thanks, values saved" is displayed on that page.
2. You can set an session variable, And increment that value, so if that value is set to 1, you can stop the value from entering into db.
|
|
|
|
|
I m using dataGrid control in my application. I want user to add records using Data Grid. Right now my Grid has 5 columns. Problem is that if user fills only one column and click add button, Grid does not add that row. Infact if i click on some other control that row from grid just disappeared. But if i fill all colums then a blank row appear down that row. and now if i click add button, this row will be added.
Now i just want a row to be added if i only fill one column. What should i do?
Day by Day Everyone is moving towards graveyard
|
|
|
|
|
Hello,
This is because the new row has not been committed in the datatable/datasource which you are using with DataGrid. You can write code in CurrentCellChanged event handler to assure that the changes you made in the datagrid are saved when you leave the cell.
HTH. Cheers.
Maqsood Ahmed - MCAD.net
Kolachi Advanced Technologies
http://www.kolachi.net
|
|
|
|
|
i am using C# windows appli,
i want my application to run automatically evry time when the user logs in.
please provide the sollution.
thank you in advance
sunny
|
|
|
|
|
Add path to exe file into Windows menu "Programs\StartUp"
or into registry
"HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run"
|
|
|
|
|
using Microsoft.Win32;
Registry.SetValue("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run","MyApp", Application.ExecutablePath);
Was it a cat I saw?
|
|
|
|
|
i am using
commandobj.parameters.add(name,datatype,size).value=value;
to add the parameters to my stored procedures as my procedure takes 15 parameters, i have to write the code for 15 times i want to pass all the parameters at a single streatch is it possible,
if yes how?
sunny
-- modified at 1:37 Friday 7th April, 2006
|
|
|
|