|
Hi
Is there any open source library C#/C++/C which will give me the delta changes of file (it can be any type)?
Thanks ...
|
|
|
|
|
Hello All,
I have an issues, i want to cancel the dropdown from being opened after validating the dropdown button clicked.
i tried with setting droppeddown property to true as suggested by one of the member from this forum in earlier post. But that is also not avoiding the dropdown from being opened.
I also tried to override the wndProc method and canceling the event it self but that is also not working . Please suggest me what i need to do so that i can avoid the dropdown after custom validation.
Thanks in Advance.
Ron
|
|
|
|
|
Hello, I think this can be done by intercepting WM_COMMAND message in "WndProc" method.
this may help
public class SuperComboBox:ComboBox
{
public class DropDownValidate:EventArgs
{
public bool AllowDropDown{get;set;}
public DropDownValidate()
{
this.AllowDropDown = true;
}
}
private const int WM_COMMAND = 0x0111;
public event EventHandler<DropDownValidate> ValidateOnDropDown;
private bool _haltDrop;
protected virtual void OnValidateDropDown(DropDownValidate e)
{
if (this.ValidateOnDropDown != null)
this.ValidateOnDropDown(this, e);
}
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_COMMAND)
{
var validationArg = new DropDownValidate();
this.OnValidateDropDown(validationArg);
_haltDrop = !validationArg.AllowDropDown;
if (_haltDrop) return;
}
base.WndProc(ref m);
}
}
Good luck
|
|
|
|
|
I have a project with many object within objects and it take a while for it to refresh when the data is changed or the form is resized. I think I have too many daisy chained events occuring.
I notice that when the Visual C# produces code it will put the "new" declarations before the SuspendLayout statement.
Object = new MediaIcon;
this.SuspendLayout();
Object.Left = 10;
.....
this.Controls.Add(Object);
this.ResumeLayout(false);
this.PerformLayout();
this is simple for a one of object, but when you have an array of them can you put the new commands within the bounds of the Suspend/Resume??
this.SuspendLayout();
Object = new MediaIcon[25];
for (int n = 0; n < 25; n++)
{
Object[n] = new MediaIcon();
Object[n].Tag = n;
.....
Object[n].Enter += new System.EventHandler(ClickButton);
this.Controls.Add(Object[n]);
}
FunctionIndex = MainForm.FunctionIndex;
this.Resize += new System.EventHandler(this.MediaBrowserClass_Resize);
this.Enter += new System.EventHandler(this.MediaBrowserClass_Enter);
this.ResumeLayout(false);
this.PerformLayout();
Could the way I am using the Suspend/Resume be the root cause of my slow refreshing?
Thank you in advance
|
|
|
|
|
Douglas Kirk wrote: I notice that when the Visual C# produces code it will put the "new" declarations before the SuspendLayout statement.
So what? The new control hasn't been added to the form's Controls collection yet, so it's not going to affect the layout of the form. it's perfectly logical to place the new outside of the suspend/resume layout block.
Douglas Kirk wrote: this is simple for a one of object, but when you have an array of them can you put the new commands within the bounds of the Suspend/Resume??
You can, but it doesn't change anything at all.
Douglas Kirk wrote: Could the way I am using the Suspend/Resume be the root cause of my slow refreshing?
No. Creating controls is a very expensive operation. If you're doing this on every refresh of the form, your creating a ton of controls every time something is dragged over your form.
|
|
|
|
|
Hi,
1.
please always show code inside PRE tags (e.g. use the "code block" widget), that makes it much more readable.
I may have overlooked something as it is now.
2.
Douglas Kirk wrote: can you put the new commands within the bounds of the Suspend/Resume??
yes. And IMO it won't make a difference.
3.
Douglas Kirk wrote: this.Controls.Add(Object[n]);
When you need to add a number of Controls, it is sometimes faster to use Controls.AddRange(), which Visual Designer also does.
4.
Not sure how long your constructors take, e.g. new MediaIcon(); that would depend on your code (not shown).
5.
Douglas Kirk wrote: it take a while for it to refresh when ... the form is resized.
That is not related to the code shown; it tells me your form probably is too complex. How many Controls are there? Do they overlap? Are there any background images? playing with transparency?
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that. All Toronto weekends should be extremely wet until we get it automated in regular forums, not just QA.
modified on Friday, February 12, 2010 4:44 AM
|
|
|
|
|
Hi friends
How to read news from a rss feed in c#
thanks in advance-kk.tvm-
|
|
|
|
|
|
You can use Rss Toolkit[^] or just parse it yourself as it is just an xml.
|
|
|
|
|
I have a List of rows/classes returned from a strong-typed DataSet.
I've written a lambda statement on it to return all of the rows that match the lambda.
I pass the lambda statement through a Select method on the IEnumerable List.
At the end of the select method I have the option to select the Min() method.
However, the Min statement returns a bool from this implementation.
I'm trying to get the min value of the column referenced in the lambda.
What do I need to do to get the Min to return an int based on a given int column in the result set?
|
|
|
|
|
Without seeing your code, it's impossible to say where you screwed up.
|
|
|
|
|
As far as I have been able to tell setting e.Handled to true does absolutely nothing. I'm wondering why it's even available for the KeyDown event. Could someone please tell me?
I have looked at the documentation for the textbox control and the KeyDown checks the value and sets some class variable, then the KeyPress checks that variable and sets e.Handled based on the value of the variable.
Thank you.- Kalvin
|
|
|
|
|
If you derive a class from TextBox, handle KeyDown event, and set Handled to true, that control will not pass the key press events to the underlying Win32 text box control, but it will still display the characters that the user typed. Set it to false so that the underlying Win32 text box control can do the default handling.
|
|
|
|
|
Hello,
I am using a combo box in my Datagridview C# windows forms .Net 2.0,
I am adding the combo box at design time , it seems to work fine when I use the collection and populate it.
But when I fill the datagridview with fill command and the values from the fill command does not exist in the combobox I get an error.
So I need a combo box which is editable.So that user can select values from combo box or write his own values.
After populating the combobox. The values in the combo box must change according to the row selected.
Is it possible using datagridview.
Thanks if anyone would help
|
|
|
|
|
I have two tables on a database where I need to gather information for a report. I have built a select statement and run it through an Odbc.DataReader. Stepping through the debugger, once ExecuteReader is executed the program stalls, for a period of minutes. Is there anyway to make this select statement more efficient?
The fields that start with INV are in the NINVREC table. The fields that start with MISCITEM are in the MISCITEM table.
The matching keys are MISCITEM-SERIAL-NBR and INV-MK-SERIAL-NBR.
The database is read only.
OdbcDataReader DbReader;
OdbcConnection DbConnection = new OdbcConnection("DSN=rsss");
OdbcCommand DbCommand = DbConnection.CreateCommand();
DbCommand.CommandText = "SELECT MISCITEM-DATE, MISCITEM-SERIAL-NBR, INV-MK-SERIAL-NBR, MISCITEM-MODEL-NBR, MISCITEM-CUST-ACCT-NBR, MISCITEM-EXCHANGE-MODEL-NBR, " +
" INV-SELL-PRICE,INV-ORIGINAL-COST, MISCITEM-ACTUAL-COST, MISCITEM-SALESMAN-1, MISCITEM-TICKET-NBR, MISCITEM-STORE FROM MISCITEM " +
" INNER JOIN NINVREC ON MISCITEM-SERIAL-NBR=INV-MK-SERIAL-NBR " +
" WHERE (MISCITEM-DATE >= '" + strEOMDate + "' AND MISCITEM-DATE <= '" + dtProcDate1.ToString("yyyy-MM-dd") + "') AND (INV-STATUS = 'S')" +
" GROUP BY MISCITEM-STORE, MISCITEM-DATE ORDER BY MISCITEM-STORE, MISCITEM-DATE";
try
{
DbConnection.Open();
DbReader = DbCommand.ExecuteReader();
while(DbReader.Read()) Jude
|
|
|
|
|
The query itself doesn't look like the problem.
Without really knowing the DB it's tough to say, but you might consider putting indexes on serial number columns in both tables. You might also include the MiscItem-Date in the index you create on the MiscItem table.
|
|
|
|
|
Unfortunately it is a read only database...or should I say we only have read only access for reporting purposes. Jude
|
|
|
|
|
Is MISCITEM-DATE a DateTime or a SmallDateTime, there can often be issues when querying on columns and the optimzer decides to convert a datetime in order not to lose percision. This may be even more possible because you have the line MISCITEM-DATE <= '" + dtProcDate1.ToString("yyyy-MM-dd") + "' . I would try paramaterizing your query.
DbCommand.CommandText =
"SELECT MISCITEM-DATE, MISCITEM-SERIAL-NBR, INV-MK-SERIAL-NBR, MISCITEM-MODEL-NBR, MISCITEM-CUST-ACCT-NBR, MISCITEM-EXCHANGE-MODEL-NBR, " +
" INV-SELL-PRICE,INV-ORIGINAL-COST, MISCITEM-ACTUAL-COST, MISCITEM-SALESMAN-1, MISCITEM-TICKET-NBR, MISCITEM-STORE FROM MISCITEM " +
" INNER JOIN NINVREC ON MISCITEM-SERIAL-NBR=INV-MK-SERIAL-NBR " +
" WHERE (MISCITEM-DATE >= @Date1 AND MISCITEM-DATE <= @Date2) AND (INV-STATUS = 'S')" +
" GROUP BY MISCITEM-STORE, MISCITEM-DATE ORDER BY MISCITEM-STORE, MISCITEM-DATE";
DbCommand.Paramaters.Add("@Date1", OdbcType.DateTime)
DbCommand.Paramaters["@Date1"].Value = strEOMDate;
DbCommand.Paramaters.Add("@Date2", OdbcType.DateTime)
DbCommand.Paramaters["@Date2"].Value = dtProcDate1;
try
{
DbConnection.Open();
DbReader = DbCommand.ExecuteReader();
while(DbReader.Read())
|
|
|
|
|
Thank you for the quick replies.
The definition for the table states DATE TIME for that field. I did a q&d query on the field and it returned in the format of mm/dd/yyyy hh:mm:ss am, but all of the times were 12:00:00 am.
I will try your solution and get back.Jude
|
|
|
|
|
Did not like. I am receiving the error "Required text is missing. : at 350 : Next Token '@' "
Hmmm.....Jude
|
|
|
|
|
Hmm sorry, looks like you have to specify your paramaters as a question mark in the actual query. I was going by my experience with SQLClient, try this
WHERE (MISCITEM-DATE >= ? AND MISCITEM-DATE <= ?) AND (INV-STATUS = 'S')"
|
|
|
|
|
True! Hmmm, but that seems to have broke it. It has been running in a console for about 10 minutes so far. One thing did change. The point of the stall is one step down in the program at the while(DbReader.Read()) statement. Jude
|
|
|
|
|
Looks like it is an index problem then, it might be something you'll just have to live with.
|
|
|
|
|
I edited the program and inserted a Timespan object. 27 minutes for the query! Ouch!
It doesn't matter to me, as the report gets generated on a Sunday while nobody is working. But it just seems like it should not take this long.Jude
|
|
|
|
|
At some point you are going to need to get some optimisation done at the database level, indexes need to be created. That is why there are reporting databases and data warehouses. There is only so much you can do with query design.
You might try and get them to allow you to use a schema then you could take snapshots of the data and manipulate it to get some performance.Never underestimate the power of human stupidity
RAH
|
|
|
|