|
Hi
I'm working on new winform project using EF and i'm looking for best approach to pass an entity between forms as parameter.
In main form i have a grid populated with i.e. customers from dbcontext like:
var db = new context();
grid.datasource = db.Customers.toList();
db.dispose();
Then i want to edit grid selected row(presents a customer record) in a new form(Detail form).
I get selected customer by this:
Customer editCustomer = (Customer)grid.selectedRows[0].dataBoundItem;
and then pass the 'editCustomer' to a new instance of Detail form constructor.
Now my problem is how to save editCustomer changes made in Detail form? (with consideration of in Detail form the editCustomer have Detached state). this really confusing me
Please help me.
Thanks.
|
|
|
|
|
The easy way is to just pass the customer ID, create a new context and retrieve the customer record using the id and manage from there.
I nicer solution would be to implement MVVM and data binding. There'd be a learning curve if you're not already familiar with the concepts.
"You get that on the big jobs."
|
|
|
|
|
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
I tried to generate a db from EDM, I created my SDM and I generated the database but it is empty, there's no table
|
|
|
|
|
Perhaps if you gave more detail and explained what EDM and SDM are, you might get some responses.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Hi All !
the size of my exe file is about 1.5 mb .I just used Microsoft.Office.Interop.Excel.dll and Word in preferences.
thanks for any help me to introduce a way to decrease the size of Exe file.
Regards !
|
|
|
|
|
Normally in a small application, the app's Icon (and any other included images/resources) are the biggest bloat.
|
|
|
|
|
Obfuscation will not only make the exe smaller but also protect your IP.
"You get that on the big jobs."
|
|
|
|
|
|
void GetDataFromDatabaseSortedByCustomerName()
{
int customerId;
}
Obfuscated
void a()
{
int a;
}
The obfuscated IL code is going to be smaller
"You get that on the big jobs."
modified 1-Apr-12 23:42pm.
|
|
|
|
|
Trouble is, it does absolutely sod all to protect your IP.
|
|
|
|
|
I definitely see obfuscation as a deterrent. At least it's going to cost them more to reverse engineer.
But sure if there just hunting down algorithms, it's pretty well useless.
"You get that on the big jobs."
|
|
|
|
|
RobCroll wrote: Obfuscation will not only make the exe smaller but also protect your IP.
Really!
I didn't know this before !
|
|
|
|
|
And you don't now. Obfuscation does not protect your IP. As a deterrent, it is next to useless if someone has a reasonable toolset available.
|
|
|
|
|
|
What's her email again?
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
1.5 Mb isn't that much; why is it a problem and what are you trying to achieve?
Bastard Programmer from Hell
|
|
|
|
|
Good day everyone. I have panels with text and images. During scrolling, painting the entire panel becomes slow. I'm therefore trying to paint only the invalid rectangle from Graphics.ClipRectangle. Processing was still slow so I had to step through the code and realised something.
I realised the paint event handler is called twice. In the first call, not all parts of the panel become invalid. I am able to get the invalid rectangle for painting.
However, after drawing in the invalid rectangle and the paint event handler exiting, the paint event handler is immediately called again but this time the invalid rectangle comprises the whole rectangle for the panel control on which i want to draw.
Thus drawing takes place twice, first for the smaller uncovered portion during scrolling, and second for the whole panel which causes the whole panel to be drawn again.
Is there any way to stop the whole panel from being invalidated after drawing only in the uncovered part of the panel during scrolling? It will really help to speed up processing. Thanks.
|
|
|
|
|
Dan_K wrote: and second for the whole panel which causes the whole panel to be drawn again
Are you invalidating the (entire) grid?
Can you post the painting code?
Bastard Programmer from Hell
|
|
|
|
|
i want to know remote network interface type & macaddress
|
|
|
|
|
|
Hi there,
Really stumped with being able to Print an envelope from my C# WinForms application.
At the moment we print from Word with the document size/type set up as a C5 or a DL envelope. When printed the printer will request a C5 or DL envelope to be placed into the manual document feeder before printing.
I want the application to be able to do the same but at the moment I am having no luck. Here is the code I am using:
Code:
aPD.DefaultPageSettings.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
if (radSizeDL.Checked)
{
aPD.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("DL Envelope", 220, 110);
aPD.DefaultPageSettings.PaperSize.PaperName = System.Drawing.Printing.PaperKind.DLEnvelope.ToString();
}
else
{
aPD.DefaultPageSettings.PaperSize = new System.Drawing.Printing.PaperSize("C5 Envelope", 229, 162);
aPD.DefaultPageSettings.PaperSize.PaperName = System.Drawing.Printing.PaperKind.C5Envelope.ToString();
}
aPD.DefaultPageSettings.Landscape = true;
aPD.OriginAtMargins = true;
aPD.PrinterSettings.Copies = Convert.ToInt16(numCopies.Value);
aPD.Print();
I am quite happy to upload the code for anyone to see if they can help me?
Please help!
Thanks.
|
|
|
|
|
Crosspost
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|
|
|
What that means is that someone using the exact same name as you posted the exact same question Printing Envelopes from Manual Feed[^]. It's called cross posting.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Please stand in front of my pistol, smile and wait for the flash - JSOP 2012
|
|
|
|