|
Have a read on MSDN and elsewhere about Windows Forms and Smart clients. I think it was Chris Sells who wrote some good articles on this subject.
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|
|
I have written a remoting package that exposes a singleton object and two singlecall objects. I would like to be able to track the creation/destruction of the singlecall objects via the IMessage interface. I have heard that this is possible, but am unsure on how to implement it.
I have been searching for info for several weeks now and all my previous posts have resulted in nothing. Please help!!!!
|
|
|
|
|
hi,
does anyone know how to change the standardprinter in a .net application?
thanks
michael
ps:
my concret problem is that i use the acrobat pdf-control to display a pfd in my application. ich even can print it with the "printAll()" methode on the standardprinter. but i found no way to set the printer the document should be printed. i even would be thankfull for a tipp to change the sprinter-settings in the pfd-control ;o)
|
|
|
|
|
Hi there,
is there anybody who has got an idea on how to catch the security-exception when starting a dot-net-executable from a network-share? I do not want to adjust the local intranet security (or do some strong naming) - just catching it. May be someone has done some stuff on how to detect the security settings for the zones or programatically adjustment?
thanx
sven
|
|
|
|
|
Just an idea, but you might try putting a try catch aroun the Application.Run(new Form1(); line in the static void Main([string[] args]) function.
|
|
|
|
|
Generally (at least in my experience) putting a try / catch around Application.Run(...) does absolutely nothing. I believe this is because exceptions only bubble up in their own thread, and Application.Run starts a new thread and message loop for the form you are creating, so no exceptions will be caught.
If you want to receive notification of the exception (on a global basis), you can hook to the AppDomain.CurrentDomain.UnhandledException event from within Main() before Application.Run(...), but you won't be able to stop the exception from terminating the program if the Framework considers the exception serious enough to do so.
In answering the original question, I don't believe there is any way to prevent the error (or catch it in such a way to allow the program to continue running) without altering the Security Configuration. If it were, there wouldn't be any security. What you are asking is something like asking the guard at a high-security building "I don't have credentials, but please let me in anyway."
-mike bray
|
|
|
|
|
Hi,
I'm using a BindableListview for which I found the code on the web:
http://www.interact-sw.co.uk/utilities/bindablelistview/source[^]
and I'm also using the ListViewSortManager found on Code Project:
http://www.codeproject.com/cs/miscctrl/lvsortmanager.asp[^]
I have found a funny interaction between the two. After binding the ListView to the DataSource (a DataTable), when the ListView is re-sorted the data gets out of sync.
For testing purposes, I added a TextBox and a CheckBox (one of the column is Boolean), which also bind to the same DataSource.
After setting the ListView and the Controls' DataSource to the same DataTable, the data is synced such that if I select a row in the ListView, the TextBox and CheckBox show the proper values.
Now, after sorting the data using different columns, the TextBox and CheckBox don't show the same values as the selected row in the ListView.
I'm assuming this is because the DataBindings are using an index, and that re-sorting the ListView differently doesn't necessarly affect that index.
How would I proceed to "re-index" the data such that clicking an item in the ListView brings up the proper data in the textBox and CheckBox ?
I've tried doing the same with the DataGrid, and found that the DataGrid works fine, ie the data stays in sync. What does the DataGrid do in order to achieve that ?
Thanks.
Luc Morin
|
|
|
|
|
I am designing a modular application where users are allowed to "wire" components together visually.
My problem now is that i have to connect a method to an event using only reflection.
So using the refleciton apis i end up with
an EventInfo representing the event, and a MethodInfo for the method. Now i want to add the method to the event as a handler.
I should use the EventInfo.AddEventHandler method. This requires a delegate for the handler. So how do i convert from the methodInfo to a delegate ?
System.Delegate has a CreateDelegate static method, but all those require a "delegate Type" argument. I suppose this is there because the compiler generates distinct delegate derived types when seeing the "delegate" C# keyword.
However i can't know all those infos in advance so i can't have a delegeate type for each possible method signature..
Is there any way around this ? So i can connect any method to any event without a compile time known delegate type... ( since this would negate the benefit of wiring components from different plugin modules together ) Of course the connectio ncan only work if the method and event have the same signature.. otherwise just an exception should be thrown.
|
|
|
|
|
Gluber2002 wrote:
However i can't know all those infos in advance so i can't have a delegeate type for each possible method signature..
This a pain, hopefully this will addressed in V2.
My suggestion would be to construct these delegates, once the assembly gets resolved in the AppDomain. Obviously these delegates will be known then and one can just attach the necesary one.
Gluber2002 wrote:
So i can connect any method to any event without a compile time known delegate type...
You cant have one without the other. So no. That scenario doesnt exist.
All method parameters are known at compile time.
Explain the situation a bit more. Are you trying to do something similar to the event method selector in the winforms editor?
leppie::AllocCPArticle("Zee blog");
|
|
|
|
|
hi evey one,
I have a problem with RichTextBox in System.Windows.Forms.
the function SuspendLayout() and ResumeLayout() doesn't work!!!
Did I do something wrong?
And what is the solution when I want to cancle the drawing of this control?
Thank you in advanced,
Eran.
|
|
|
|
|
You cant "suspend" drawing with those methods, they are for child controls.
You will have to use interop with SendMessage and set the WM_SETREDRAW to 0(off) or 1(on)
leppie::AllocCPArticle("Zee blog");
|
|
|
|
|
In order to create an idl/typelib/dll compatible with my existing COM container, I need to expose my C# properties as idl properties rather than idl methods, i.e.
properties:
[id(0x00000001)]
BSTR MyProperty;
rather than:
methods:
[id(0x00000001), propput]
BSTR MyProperty();
[id(0x00000002), propput]
void MyProperty([in] BSTR rhs);
The COM interop help suggests exposing interfaces to COM rather than the class/object itself (which suits me fine) except that interfaces cannot have fields in C# and C# properties are exposed as methods
Can anyone tell me how to expose 'properties' in their idl sense?
TIA
Elbie
"I would try everything once except incest and line dancing", Oscar Wilde
|
|
|
|
|
I noticed that TextEditBase or RichEditBox does not allow the Paint to be overriden.
I can intercept the WM_PAINT message by overriding WndProc. I'm basically trying to implement a left margin with number numbers in RichEditBox, now this is real easy using MFC/Win32 by implementing a OnPaint/WM_PAINT message validating the margin, calling Default/DefWindowProc then invalidating the margin and the drawing the margin in the begin paint...
Ok here's the snippet:
void CWinRETestView::OnPaint()
{
CRect rc;
GetClientRect(rc);
int nSave = rc.right;
rc.right = m_nMargin;
ValidateRect(rc);
Default();
InvalidateRect(rc);
CPaintDC dc(this); // device context for painting
DrawMargin(rc, dc);
}
How can this be done using RichEditBox using C#, .net?
|
|
|
|
|
Hallo *.*,
how do I convert IPicture to Image? I know there is a HANDLE field, but whenever I call Image.FromHbitmap(handle), it fails with an ExternalException in system.drawing.dll.
What am I doing wrong?
//get an IPicture of the visible MapPoint map
MapPointUtilities util = new MapPointUtilitiesClass();
Object obj = util.GetPictureFromObject(mapControl.ActiveMap, 100000, 100000);
//get the handle
Type t = obj.GetType();
Object handle = t.InvokeMember("HANDLE", BindingFlags.GetProperty, null, obj, null);
//convert the handle
Int32 intHandle = (Int32)handle;
IntPtr ptrHandle = new IntPtr(intHandle);
//get the image
Image img = Image.FromHbitmap(ptrHandle);
//does not work either
//Bitmap bmp = Bitmap.FromHbitmap(ptrHandle);
Image.FromHbitmap throws this exception:
System.Runtime.InteropServices.ExternalException' in system.drawing.dll
Additional Information: A general error has occurred in GDI+
Thanks for every hint,
Corinna
|
|
|
|
|
I'm reading in some XML where the date is formatted like: Mon, 01 Sep 2003 11:50:00 PDT. I can read this element as text and I want to convert it to a System.DateTime but the XmlConvert.ToDateTime and DateTime.Parse don't seem to support a format for the timezone (i.e. interpretting the "PDT"). I've also looked at the TimeZone class but no help.
Can anyone give some direction on how to handle this formatting-wise either by telling me what format represents timezone (no "zzz" doesn't work) or a class/method that can help here?
Thanks.
|
|
|
|
|
Anything that goes into a collection must also be Serializable if you want to serialize it. So make sure CodeItem is set as Serializable.
dog_spawn
http://www.hatekill.com[^]
|
|
|
|
|
Hi there,
I set up a DataSet (C#/.net) with a few tables, one table containing the DataSet Primary Key and the other tables containing only Foreign Key refering to the PK.
Now I am trying to populate the DataSet manually, reading from a Binary File:
FileStream fs = new FileStream("C:\\File", FileMode.Open);
Byte[] abyBuffer = new Byte[fs.Length];
BinaryReader r = new BinaryReader(fs);
db3plus.headerRow hrow = db3plus1.header.NewheaderRow();
hrow.version = r.ReadByte();
db3plus1.header.Rows.Add(hrow);
db3plus.lastupdateRow lrow = db3plus1.lastupdate.NewlastupdateRow();
lrow.byte1 = r.ReadByte();
lrow.byte2 = r.ReadByte();
db3plus1.lastupdate.Rows.Add(lrow);
The thing is, the Relation I set up between these two tables seems to be lost, since the second entry won't be inserted in the same DataSet as the first entry.
Leaving me with the second Table not having a Relation (Foreign Key) to the Parent-Table
Any help?????
|
|
|
|
|
I think I know the answer to this, but one thing to check first: when is it 'lost'?
dog_spawn
http://www.hatekill.com[^]
|
|
|
|
|
Hi,
I've already found out what I did wrong: I thought when working with a typed DataSet, when I create new Rows and add them to a Table, my Relations would be automatically set.
But I actually had to use the SetParentRow Method...
But still it would be helpful to get some feedback on this, since I don't really know, if this isn't totally bull*hit, what I'm doing here:
db3plus.headerRow hrow = db3plus1.header.NewheaderRow();
hrow.version = r.ReadByte();
db3plus1.header.Rows.Add(hrow);
db3plus.lastupdateRow lrow = db3plus1.lastupdate.NewlastupdateRow();
lrow.SetParentRow(hrow);
lrow.byte1 = r.ReadByte();
lrow.byte2 = r.ReadByte();
lrow.byte3 = r.ReadByte();
db3plus1.lastupdate.Rows.Add(lrow);
THANKS
|
|
|
|
|
I am writing a .NET control to run inside an ActiveX Container. Our existing interface uses VARIANT* and this needs to be maintained.
I've used ref Object as a type in order for Studio to create a VARIANT* type against my function in the type library but I can't seem to pass any objects out of the control without generating a runtime exception or a compile error.
I've tried using an Object member variable and passing it out as SendMessage( ref m_MyObject ); (which compiles).
I actually need to be able to pass out types as variants (mostly doubles and strings).
Anyone know why I can't do this or how I should do it?
Thanks
|
|
|
|
|
Actually, could the exception be caused by the container not implementing the message event? (it's the old "Object reference not set to an instance of an object" exception). I assumed it was complaining about the objects passed out of the function rather than the function call itself.
Luke
|
|
|
|
|
Just suggestion:
Maybe you should consider wrapper ActiveX Control that you insert into your ActiveX Container, that will wrap .NET control methods according to your container rules and delegates calls to .Net control, while converting arguments from VARIANT* to default types expected by .Net control...
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
Hello
Is there some way how to use windows forms or some third party .net controls and components in my MFC application?
I have a application, with MFC and COM controls and I' d like to use there some third party .NET components.
In all MS examples for MC++, there is only shown,. how to create applicatino, that opens new window with this windows forms controls.
Thanks
|
|
|
|
|
Tom Archer and Nishant S (two well known CP members) wrote a book on this recently. Extending MFC Applications with the .Net Framework[^]
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
yes, but this book is being published in december
don't you know, whether there is some possibility to buy electronical version or so?
Thanks
|
|
|
|