|
|
Hi guys
I have a form that has like 30 controls on them all of them have data that it loads to from a DB, is there a efficient way to only get the data or control that was modified?
Thanks
|
|
|
|
|
You might like to take a look at Masks and flags using bit fields in .NET[^].
Assign each control on your form a binary value and set a flag if it's data gets modified.
If there were less controls I would suggest an enumeration with the Flags attribute but I'm not sure (without looking it up) if an enum can handle that many.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Henry Minute wrote: I'm not sure if an enum can handle that many.
"An enumeration is a named constant whose underlying type is any integral type except Char".
So if you have it derive from int (the default) or uint, you get 32 flags; from long/ulong 64.
That is one for each available bit.
|
|
|
|
|
I notice that in your quote from my post you carefully avoided including the part in braces.
Probably due to my age, as others have pointed out elsewhere, I couldn't remember if enums used a sensible storage strategy or not. Which is why I said 'without looking it up'.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Only trying to help. I am convinced you would know when you looked it up, however I wanted to save you the trouble as you were concentrating on your game and/or celebrating your winnings.
|
|
|
|
|
The last time I needeed to do something like that, I built it into a data class that held all the values. The textboxs were bound to those values through properties on the data class. Each property did its validation and then set a dirty flag if the value actually changed. Once the data object serialized itself, the dirty flags were reset.
|
|
|
|
|
This particular way has the advantage of knowing which control was really modified, what i mean is that if a user has a textfield init with the text "Hello" and user erases/modifies and then retry the same value it shouldn't be marked as modified, doing this way will ensure that it has diferent data, but it seems that the vest way is to copy the init data in a structure/class for each form right?
|
|
|
|
|
manchukuo wrote: the vest way is to copy the init data in a structure/class for each form right?
That's pretty much the standard. You could also compare it against the last value that was stored in the database, but that pretty much defeats the purpose of avoiding a database call. You can also get a hash of the initial data (e.g., GetHashCode) and compare that to the hash code for the new data (this will minimize the amount of memory used and will be correct most of the time). If you combine that with dirty checking, you will have a pretty good way of minimizing data transfer.
|
|
|
|
|
mmhh i see thanks for all your time and help i will try the hash stuff
|
|
|
|
|
hello
i working on my assignment for win form app. there are 2 tables related. and now final part is to create crystal report i have created one report showing bill details it works fine there is no issure.
now i want to display amounnt in words so i have created one class and to convert number to words and again it's working fine but i am not storing this amount in words in sql database.
so in reporting how can i convert this amount in number into words?
is there any way to call my numbertoword class into crystal report?
or is there any tool in crystal report to do this?
this is my code for loading crystal report
public partial class InvoiceBill : Form
{
public InvoiceBill()
{
InitializeComponent();
}
public GenerateInvoice invRpt = new GenerateInvoice();
private void InvoiceBill_Load(object sender, EventArgs e)
{
sqlDataAdapter1.Fill(invoiceDS1 , "BillDetail");
crystalReportViewer1.ReportSource = invRpt;
invRpt.SetDataSource(invoiceDS1);
}
waiting for your kind help
|
|
|
|
|
ok it's done now
there is inbult function for this in crystal report
ToWord()
|
|
|
|
|
hi guys
how to send file with bluetooth with socket programing ?
thanks a lot
|
|
|
|
|
|
Please consider the following code fragment:
<br />
protected override void OnPaint( PaintEventArgs paintEventArgs )<br />
{<br />
Graphics grfx = paintEventArgs.Graphics;<br />
int width = this.ClientSize.Width;<br />
int height = this.ClientSize.Height;<br />
grfx.TranslateTransform( width / 2, height / 2 );<br />
I now claim that after executing the call to TranslateTransform the point 0,0 will
be the center of the screen. However, increasing y values still bring be down. That
is, the point (0,3) will be below, the point (0,0). I would like increasing y values
to bring me up the screen. Is there a way to do this, and if so, how?
Thanks
Bob
|
|
|
|
|
While I haven't actually done so, I expect there are a couple, related, ways to achieve this.
The simplest would be to append the statement:
grpf.ScaleTransform(1.0f, -1.0f);
An alternative would be to specify the entire transformation matrix (with lots of zeros, your width/2 and height/2, and a single -1 in there). In the end, I expect such matrix is what is used internally, all the XxxTransform calls simply modify said matrix (starting from a unity matrix).
|
|
|
|
|
Hello,
i have excel from which i need to read the data though c# code.
Excel having groued columns so iam not able to read those columns.
can any one tell me how to un group excel column and save tht changed excel.
My code is as follwes which failed
private void UnGroupRowsAndColumns(Workbook workbook)
{
Worksheet worksheet = workbook.Worksheets[0];
worksheet.Cells.UngroupRows(0, 9);
worksheet.Cells.UngroupColumns(0, 1);
}
|
|
|
|
|
Please do not post to multiple forums. You have already received a response in the C++ forum for this exact question.
It's time for a new signature.
|
|
|
|
|
I never tried drawing using C#.
I have a medical software which has th head image and I want to know how to do the following:
1. when the mouse is over the head then i should do nothing other than mark or unmark
2. when the user clicks on the head image on area which doesn't have x mark then it should mark it
3. when the user clicks on the head image on area which has x mark then it should unmark it
I want a small tiny x mark, something like 14X14 and in RED.
|
|
|
|
|
I'm afraid quite some information is missing.
1.
How is the image being displayed (Graphics.DrawImage, PictureBox.Image, Panel.BackgroundImage)? Is it your app that uses C# and needs some functionality added? or do you hope to get the extra's on top of some existing app you can't change?
2.
how many marks can there be at any one time? and what is the size of an "area" (each of the ones that are either marked or not marked)?
|
|
|
|
|
jrahma wrote: I want a small tiny x mark, something like 14X14 and in RED.
That sounds more like an assignment than a question..
Anyway, to get you started; Set the head as a background image. Use a Panel to display the bitmap. Now, the computer doesn't distinguish between area's like humans. There's no way to distinguish between 'unmark that x' and 'put a mark very, very close to that one'. You could divide the bitmap into square blocks to represent clickable area's. That way you could create an array to represent the marked and unmarked blocks. It would otherwise be hard to "find" an X when it's painted on the head-picture itself. The best alternative would be to divide it into two layers, a background and a list of markers;
- Create a generic list of points.
- When the user clicks on the head, add the location to the generic list. Wipe the control, draw bitmaps (with a red X) on all the locations in your list.
- When you reload the picture (e.g. user opens the app on the next day), load your backgroundhead and paint the markers over it.
- When the user wants to delete a marker, show the list and ask which one. If the user selects an item in the list, then highlight it on the picture (e.g. a blue X instead of red, so they can see which one is going to be deleted)
See Google Earth if you want to try the concept
I are Troll
|
|
|
|
|
hi all!
i need c# control for tracing logs that can contain a lot of lines and be quick to scroll and to draw like in the application "registry monitor", "file monitor" or output window in VS, etc...
i tried to make virtual list in the list view, but it didn't help. may be i did something wrong...
could you please help me? may be you know how to implement or some links in the internet with the ideas or implementations?
thanks,
Pavel
ISQ 469907496
|
|
|
|
|
I like ListBox a lot as it is line-oriented and knows to handle millions of lines pretty well. Here[^] is a typical use.
When necessary, I make it UserDrawn so I can have more control on formatting (quite often all I need is some text lines in bold and/or a different color).
|
|
|
|
|
thanks, but i need multi-column control... so, listbox will not be helpfull
ISQ 469907496
|
|
|
|
|
again, OwnerDrawn allows for lots of formatting. I've done columnar output with ListBox. You can make it look like a DataGridView (without the column sort facilities).
|
|
|
|