|
It s a bug in VS, that doesnt refresh it resources. Just remove the file (not delete) so VS can know something happened to it (just build or something to create an error), then just re-add it.
top secret xacc-ide 0.0.1
|
|
|
|
|
I managed to get both the problems you described. Your solutions solved it. Thanks!
|
|
|
|
|
Hi All
I've got a remoting situation setup where the server class is running in a windows service from my server. I have setup a test on the client that gets this remote server class and call methods on it. My test method just says .AreYouThere() and returns a string that says "Yes". This works fine. My next method test was to return a custom class that wraps an arraylist and just contains a list of years.
When I create a method on my remote server class called .GetYears() it should return a Years object. But my application bombs out at this point... My remote server class is setup like this...
public class RaceServerClass : MarshalByRefObject
do I have to setup my object that I want to pass back with that as well... or do they need something else special.
Thanks
Bryan
|
|
|
|
|
Returning MarshalByRefObjects across remoting boundaries can be a security flaw; in .NET 1.1 Microsoft made the passing of object references throw an exception. There is a way around this, you must specify TypeFilterLevel as full when registering your channel. For instance, through code:
BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider();
provider.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
props = new HashTable();
props["port"] = 2264;
HttpChannel chan = new HttpChannel(props,
new BinaryClientFormatterSinkProvider(), provider);
ChannelServices.RegisterChannel( chan );
It can also be done through the server & client .config files. For more information, see this page[^].
#include "witty_sig.h"
|
|
|
|
|
Oh I should mention, if you don't need to modify the actual Years object on the client side, then don't make it MarshalByRefObj. Just add the [Serializable] attribute to the beginning of the class and you'll be able to pass a copy of the years object across remoting boundaries without problems.
#include "witty_sig.h"
|
|
|
|
|
I had actually found source similiar to the one you posted about giving full control and have implemented that. I'm guessing that my years object that my remote server object is returning needs the marshalbyrefobj... I plan on modifying it. I will try it tonight and post back if I have problems.
Thanks for the post!
|
|
|
|
|
I don't remember much about what I studied about remoting but here's something to start with. Are you serializing the class? Like:
[Serializable]
public class myClass
{
...
}
|
|
|
|
|
What do you mean "bombs out"? Any object being passed around remoting must be derived from MarshalByRefObject because it must cross application boundries.
If you can actually give an exception object or the exception method that would be helpful.
Also a pitfall almost everyone new to .Net Remoting (as well as any other remote procedure framework) is that since objects live in two different application domains they aren't exactly equal. It is even warned in the MSDN documentatino:
<br />
Types must inherit from MarshalByRefObject when the type is used across application domain boundaries, and the state of the object must not be copied because the members of the object are not usable outside the application domain where they were created.<br />
So if your server twiddles the value of the object passed to it, those values are lost to the client upon leaving the method.
|
|
|
|
|
Heres an update...
I made all my data objects use MarshalByRefObject. What I meant by "bombs out" was that my application was causing an error that wasn't an exception in .net... it was generating a windows error... but I fixed that.
I now have this up and running and it works good. Heres a small example of what I'm doing. I'm building a race management software suite ( backend, web admin, public web, admin winform ). I wanted all to be able to use the same backend so I thought I would use .Net Remoting to provide a service for the other three to use to access the data from the db.
Thanks for the help.
Bryan
|
|
|
|
|
Dear, Sir and Madam
When I set SelectedObject property of PropertyGrid to DataTable and click ellipses button to modify Coloumns property of DataTable
the "DataColumn Collection Editor" appear. But Add and Remove button of this dialog is disabled Is it possible to Enabled them to allow user add and remove via this dialog
Sorry for bad English.
Thank You.
|
|
|
|
|
I assume you're doing this at runtime. There are a number of designer interfaces - like IWindowsFormsEditorService - that you need to provide by the container (whatever is hosting the DataGrid ), as well as implement ISite and set that on the child controls.
The design-time environment is much different from the runtime environment, and in the design environment the IDE (VS.NET, #develop, whatever) provides these services to make TypeConverter s and UITypeEditor s (among other things) possible.
Read-up on the design-time model in the .NET Framework SDK. There's a lot you need to know and understand.
Besides, another reason - most likely the problem - is that the Add and Remove buttons are disabled because the designer cannot serialize to source - there is no source since you're running a compiled executable.
Microsoft MVP, Visual C#
My Articles
|
|
|
|
|
I would like to allow my users the opportunity to update changes on a control in a particular tab when they try to leave. To do this I use the user control thats loaded into the tab's Validating event (Catching the event in the tabbedcontrol itself will not find the changes). The event is caught and a dialog box is fired off to ask whether or not theyd like to leave.
Problem 1: the Validating event is fired twice when a user tries to leave the tab.
Problem 2: the call to e.cancel = true gets enforced not on the two times when its leaving, but rather when the tab is getting the focus once again, ie the cancel call doesnt do anything until you leave the tab and then try and come back.
Any suggetions?
Thank You
Robert
|
|
|
|
|
yeah so this absolutely does not work
// In C#
private void tabPage1_Validating(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel = true;
}
And it will get called twice before the focus actually leaves the tab, which its allowed to do. Then attempting to return to that tab, it will cancel.
Any ideas?
|
|
|
|
|
I thought I would post this just in case anyone was wondering how to go about doing Role based security with windows forms
Now most of the applications that I have written have been on the web so Role based security was ease
if (User.IsInRole("Power Users"))
{
.. code here
}
Now I am doing a windows application that requires Role based security..
So here is what I did..
public System.Security.Principal.WindowsPrincipal User;
this.User = new System.Security.Principal.WindowsPrincipal(System.Security.Principal.WindowsIdentity.GetCurrent() );
if (User.IsInRole("Power Users"))
{
.. code here
}
thats it!! easy stuff..
well like I said, I just wanted to post this for anyone who may need it.
Will
|
|
|
|
|
Anyone tried launching a copy of Word 2003 using Process.Start. You may be interested to find that Word for some reason, spaws a seperate copy of itself in another process, and the handle that you have in the code immediately exits. Hmmm. Not the case for Excel. Just wondering what MS's logic was with that one.
"Je pense, donc je mange." - Rene Descartes 1689 - Just before his mother put his tea on the table.
Shameless Plug - Distributed Database Transactions in .NET using COM+
|
|
|
|
|
I'm trying to find out the printable area of my printer.
The first try was this:
void OnPrintPageBoard(object obj, PrintPageEventArgs ppea)
{
Graphics grfx = ppea.Graphics;
grfx.PageUnit = GraphicsUnit.Millimeter;
RectangleF rectf = new RectangleF(
ppea.MarginBounds.Left -
(ppea.PageBounds.Width - grfx.VisibleClipBounds.Width) / 2,
ppea.MarginBounds.Top -
(ppea.PageBounds.Height - grfx.VisibleClipBounds.Height) / 2,
ppea.MarginBounds.Width,
ppea.MarginBounds.Height);
Pen myPen = new Pen(Color.Black,1);
grfx.DrawRectangle(myPen,rectf.X, rectf.Y,rectf.Width,rectf.Height);
}
But this didn't work at all.
Second try was this:
void OnPrintPageBoard(object obj, PrintPageEventArgs ppea)
{
Graphics grfx = ppea.Graphics;
RectangleF rectf = new RectangleF(
ppea.MarginBounds.Left -
(ppea.PageBounds.Width - grfx.VisibleClipBounds.Width) / 2,
ppea.MarginBounds.Top -
(ppea.PageBounds.Height - grfx.VisibleClipBounds.Height) / 2,
ppea.MarginBounds.Width,
ppea.MarginBounds.Height);
double dPrintableAreaX = PrinterUnitConvert.Convert(rectf.X, PrinterUnit.Display, PrinterUnit.TenthsOfAMillimeter)/10;
double dPrintableAreaY = PrinterUnitConvert.Convert(rectf.Y, PrinterUnit.Display, PrinterUnit.TenthsOfAMillimeter)/10;
double dPrintableAreaWidth = PrinterUnitConvert.Convert(rectf.Width, PrinterUnit.Display, PrinterUnit.TenthsOfAMillimeter)/10;
double dPrintableAreaHeight = PrinterUnitConvert.Convert(rectf.Height, PrinterUnit.Display, PrinterUnit.TenthsOfAMillimeter)/10;
grfx.PageUnit = GraphicsUnit.Millimeter;
Pen myPen = new Pen(Color.Black,1);
grfx.DrawRectangle(myPen, (float)dPrintableAreaX, (float)dPrintableAreaY, (float)dPrintableAreaWidth, (float)dPrintableAreaHeight);
}
This worked, but the rectangle is way smaller than I expected! If I draw for example like grfx.DrawRectangle(myPen, 0, 0, 100, 100), the rectangle is more at the border of the page.
I also don't understand, why the values of the rectf of my first example don't have the same value as dPrintableAreaX,dPrintableAreaY,dPrintableAreaWidth,dPrintableAreaHeight of my second example. Should be millimeters either way, shouldn't it?
Best Regards
Bernd R.
The light at the end of the tunnel has been switched off temporarily due to budget problems...
|
|
|
|
|
Now I got it:
void OnPrintPageBoard(object obj, PrintPageEventArgs ppea)
{
Graphics grfx = ppea.Graphics;
double dPrintableWidth = PrinterUnitConvert.Convert(grfx.VisibleClipBounds.Width, PrinterUnit.Display, PrinterUnit.TenthsOfAMillimeter)/10;
double dPrintableHeight = PrinterUnitConvert.Convert(grfx.VisibleClipBounds.Height, PrinterUnit.Display, PrinterUnit.TenthsOfAMillimeter)/10;
grfx.PageUnit = GraphicsUnit.Millimeter;
Pen myPen = new Pen(Color.Black,1);
grfx.DrawRectangle(myPen, 0, 0, (float)dPrintableWidth, (float)dPrintableHeight);
}
Printing is hard!
----------------------------
The light at the end of the tunnel has been switched off temporarily due to budget problems...
|
|
|
|
|
you also might wanna check this out:
http://www.codeproject.com/csharp/DotNetprinterbounds.asp
it's about finding the true printer margins of a printer, since these vary from printer to printer and (from what I know of)
can't be found through the .NET framework.
|
|
|
|
|
I have to transfer a data base from old to new one in batch.
I am working with the Data transformation services at the sql server.
How can i run/excute a dts package from a stored procedure or from the query analyzer? .
Is it possible?, I know i can do it from the command prompt but it does't help me
Thanks in advance
Be Good...
Dudi
|
|
|
|
|
|
I've recently started a new job, where they have purchased pocket pc devices with the intent of communicating with their unixware server over GPRS. This is fine and lends itself well to their intended application. The problem is they want to do this via Telnet! To me this sounds crazy but they insist on doing it this way. How is it possible using C# on Pocket PC for me to communicate via Telnet in a controlled fashion so that I may handle dropped GPRS to their server!
I'd really love to hear ideas on the subject ans possible sugestions!
Schkin
|
|
|
|
|
Telnet is Evil. Your major problem is that there's no way to pick up a dropped session - the session is tied intimately to the state of the TCP connection: lose the connection, lose the session.
This probably isn't the answer you want to hear, but I recommend implementing the Telnet client as a server process on a server somewhere, then implementing some reconnectable protocol, that allows you to specify a session to reconnect to, between the handheld and the front-end server.
I assume that the point of connecting to the Unixware server over Telnet is to scrape data from the screen? Implementing the screen-scraping in the server would be more sensible, IMO; you could implement the handheld-to-server interface using a Web service. You could probably convince your admins that exposing a web service over HTTP/HTTPS is more secure than exposing direct access to Telnet over the internet (even if you're going to use a VPN).
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hello big guys,
I remember using a FlexGrid in VB6, I want to use a component like that in C#.
I know there is that component for sale... I can't buy that in my MP.
All I need to do is to have rows to enter text.. like in Exel.
I cannot use a multiline textbox.
HELP!
_____________________________________________________
Believe! Every thing has a purpose
|
|
|
|
|
|
yes I went through that last night, but I can find only the database connectivity & property modification. All I want is a row-ised text box.!
_____________________________________________________
Believe! Every thing has a purpose
|
|
|
|