15,749,279 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View Javascript questions
View C++ questions
View Python questions
View Java questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Daniele Rota Nodari (Top 45 by date)
Daniele Rota Nodari
8-Feb-23 11:48am
View
Is your application running as administrator?
If debugging from Visual studio, is VS running as administrator?
Have you tried hooking CreateProcessAsUser and CreateProcessWithLogonW ? See https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-createprocessw for more info about them.
Daniele Rota Nodari
1-Aug-22 6:57am
View
What method does the "relevant code" come from?
Why are you hiding/showing child controls if the triggering event is a parent window restore (that should not affect children layout and visibility)?
Have IsAppRunning anything to do with the TextBox/RichTextBox swap logic or the minimize/restore events (maybe you wanted to check for IsHandleCreated and Disposing/IsDisposed properties)?
Daniele Rota Nodari
1-Aug-22 6:51am
View
Better don't use UI controls as data containers. Reading/Writing data (like TextBox.Text) involves copying, allocations, marshalling operations and other unwanted overhead (like cross-thread invocations).
Keep your text elsewhere (e.g.: local field or property) and use it for any data-aware operation (like searching).
Try also to cut down the times you set the Text property, by batching/merging updates and using optimized methods, like AppendText.
Obsviously such approach might require complex structures to link the raw data to the UI counterpart, so you have to evaluate a proper trade-off.
Anyway, you may end up without the need of a TextBox.
Daniele Rota Nodari
31-May-21 10:28am
View
What is the relation between the two forms? do them exist independently or one is open as consequence of an action on the other form?
Daniele Rota Nodari
21-Apr-20 6:01am
View
My previous reply was lost! :(
PlaceLoc substitutes Place everywhere you are using it to fetch the unique combinations.
That means inside the CROSS JOIN (and inside _All). After substitution, the DISTINCT keyword will no longer make difference and you can remove it.
You are using "select DISTINCT PLACE......" to gather exactly what is already inside PlaceLoc.
Daniele Rota Nodari
20-Apr-20 14:39pm
View
The records are duplicated, then you need to instruct the query processor to avoid repetitions.
An alternative to DISTINCT is GROUP BY, but id would not add value to the query; it would render it longer and less readbale.
The only way to avoid duplication is to prevent it by having a table containing only the key combination records; that is, a table with only PlaceId and Loc fields, populated without repetitions; that would become a master/parent table.
Daniele Rota Nodari
20-Apr-20 10:56am
View
Yes, as you already did, disposing the Graphics objects is important to reduce resource usage, and "using" is an easy way to ensure that.
This is a further reason to move "Save" out of "using", in order to dispose Graphics objects as soon as they are no longer needed.
You can move before any "using" block any instruction that DOES NOT interact with the Graphics object allocated by that "using"; this could also help into refactoring code by moving some code to new, specialized, methods (e.g.: there are 2 "using(Graphics...." blocks that seem almost identical to each other).
Last thing: using/Dispose are missing for tempBitmap; pay attention to this one because two new Bitmap objects are assigned to that variable.
Daniele Rota Nodari
20-Apr-20 6:01am
View
I would check effects of "SetResolution", in case postponing its invocation or trying avoiding it.
Variable myEncoderParameters is another candidate.
In additon, I would move all "Save" invocations out of "using (Graphics)" blocks (this would also allow to move SetResolution between using block and Save invocation).
Daniele Rota Nodari
20-Apr-20 5:50am
View
Have you tried Invalidate instead of Refresh?
Does RotatingFlash regenerate the image? Does it test the current timestamp (thorugh date/time, ticks, StopWatch or whatever...) or simply increments a frame counter?
Daniele Rota Nodari
20-Apr-20 5:40am
View
What are the exact error exception and message?
If it refers only to FileMode, than could be that the GetStream method does not support that specific mode; usually FileMode.CreateNow is used to create (and write) a new file, not to read an existing one.
Write responsibility in your code seems delegated to XmlWriter only and mainPart.GetStream seems to return (read) a stream of existing data.
Daniele Rota Nodari
20-Apr-20 5:26am
View
Did you mean that the toolstrip button should be disabled when the form is shown and the button should be re-enabled when the form closes?
What happens to the other buttons? You have to disable or enable them when the form becomes visible or closes?
Anyway, the current loop contents are equivalent to a simpler "item.Enabled=(item!=sender);"; that does not change the result but makes the code more readable and maintenable.
In case, you can save "item!=sender" to a locale variable and assign that variable to "item.Enabled":
var itemIsSender = item == sender;
item.Enabled = !itemIsSender;
Daniele Rota Nodari
20-Apr-20 4:51am
View
The result (third table) is NOT the representation of what you ask.
All the days from the first table are used in the second table (all DayId values are present).
Maybe you should clarift what do you mean for "used" or "not used".
Does "used" mean that a combination of PlaceId+Loc has that specific DayId?
Daniele Rota Nodari
22-Jan-19 11:09am
View
Searching in RegEdit should not be an issue, even if you input wrong search parameters: if it really hangs the system, then I'd look for something more serious than a DLL mismatch. It could be a registry corruption that prevents correct system behavior and might yield to unpredictable issues.
Daniele Rota Nodari
22-Jan-19 11:08am
View
Deleted
Searching in RegEdit should not be an issue, even if you input wrong search parameters: if it really hangs the system, then I'd look for something more serious than a DLL mismatch. It could be a registry corruption that prevents correct system behavior and might yield to unpredictable issues.
Daniele Rota Nodari
22-Jan-19 11:08am
View
Deleted
Searching in RegEdit should not be an issue, even if you input wrong search parameters: if it really hangs the system, then I'd look for something more serious than a DLL mismatch. It could be a registry corruption that prevents correct system behavior and might yield to unpredictable issues.
Daniele Rota Nodari
19-Feb-18 3:30am
View
What do you mean with "modification" ?
Daniele Rota Nodari
11-Dec-14 9:47am
View
It seem I overlooked your problem.
It could be that all your problems are within the initial loop.
for(int q=0;q<=4;q++){
for(int j=0;j<=4;j++){
a[q,j] = textBox1.Text[q].ToString();
}
}
try to rewrite it as
var asLines = textBox1.Text.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
for(int q=0;q<=4;q++){
for(int j=0;j<=4;j++){
a[q,j] = asLines[q][j].ToString();
}
}
Let me know the result
Daniele Rota Nodari
11-Dec-14 9:44am
View
Deleted
It seem I overlooked your problem.
It could be that all your problems are within the initial loop.
for(int q=0;q<=4;q++){
for(int j=0;j<=4;j++){
a[q,j] = textBox1.Text[q].ToString();
}
}
maybe that
a[q,j] = textBox1.Text[q].ToString();
have to be fixed into
a[q,j] = textBox1.Text[q][j];
Let me know the result
Daniele Rota Nodari
10-Dec-14 10:26am
View
What value do you expect to find after reset? Is 0 okay?
Why you don't want to set Value property? Do you want to avoid firing events or there is some other reason?
Daniele Rota Nodari
21-Nov-14 6:56am
View
I just improved the solution to show you how to obtain that behavior in C#.
Anyhow, I encourage you to adopt in VB.NET the same approach C# is using by default.
More, I suggest you to study all the provided links and the Encoding class.
Daniele Rota Nodari
23-Jul-14 2:44am
View
Hi there.
Have you resolved this issue?
Daniele Rota Nodari
15-Jul-14 8:16am
View
I'm glad to have been helpful. :)
Daniele.
Daniele Rota Nodari
15-Jul-14 8:01am
View
That should mean that Me.Controls(sInitCtrlName) returned Nothing
This might be due to Me not being the parent of the label control or sInitCtrlName containing a wrong name.
You should make sure that sInitCtrlName contains the right full name of the label control and which container is the parent of the label control (being it Me or a sub control like a Panel).
Just to be more clear, if the label control is layed inside a sub control of Me (e.g.: "panel1"), you should replace "Me.Controls" with "panel1.Controls". The easiest ways you can determine what is the right control are through the designer window or the "document layout" window.
As an alternative to Me.Controls(sInitCtrlName) you can also use Me.Controls.Find(sInitCtrlName, true), but this will return an array of Control objects, not only one.
More, as a general rule because InitCtrl is obtained dynamically, before using it you should always check for a valid value.
For further details you can look at http://msdn.microsoft.com/en-us/library/system.windows.forms.control.controls%28v=vs.100%29.aspx and http://msdn.microsoft.com/en-us/library/system.windows.forms.control.controlcollection%28v=vs.100%29.aspx
Regards,
Daniele.
Daniele Rota Nodari
15-Apr-14 4:32am
View
Hi.
If you want Count(ID) value for each combination of FILELOGID and RECORDNO then you have to add a GROUP BY clause similar to the last ORDER BY (insert "GROUP BY FILELOGID, RECORDNO" before "Order by FILELOGID, RECORDNO"); otherwise (if you want Count(ID) for any FILELOGID and RECORDNO) remove the last ORDER BY clause at all.
Regards,
Daniele.
Daniele Rota Nodari
14-Apr-14 17:21pm
View
Reason for my vote of 1 \n You didn't explain how to obtain that information, more this seems more a tip than an article.
Daniele Rota Nodari
15-Jan-14 3:09am
View
Reason for my vote of 5 \n Simple and tasty! :)
Daniele Rota Nodari
12-Jun-13 10:25am
View
Reason for my vote of 1 \n Sorry but...
Inappropriate or obscure introduction (what "use system applications using C#" does mean?).
Example covers only little part of the concept (two classes have been used and only simplest methods have been pictured, with minimal explanation).
Very basic example that produces no useful results (a blank medium sized image).
Final goal of tip does not justify the tip itself (you can obtain same result without creating such a basic application).
Daniele Rota Nodari
11-Jun-13 7:55am
View
Reason for my vote of 3 \n Hi.
This tip only points in a direction but does not cover details.
You should improve it explaining parameter usage of those methods and add more info about the native structures or enumerations used.
Daniele Rota Nodari
28-Jan-13 6:45am
View
Hi.
I can see that the Conc function expects 6 parameters but only 4 are passed to it; then, the inner SQL uses all the 6 parameters (including the 2 unassigned).
Daniele Rota Nodari
24-Jan-13 2:55am
View
Hi.
You wrote that the exported file is not readable, but the sample code you provided shows only import function.
You should add more details about export process or about importing errors or imported results.
Daniele Rota Nodari
18-Jan-13 8:17am
View
I know :) and I hope it really solved your issue.
Daniele Rota Nodari
17-Jan-13 14:12pm
View
Someone did not like this solution.
Can this one kindly explain what's wrong?
Daniele Rota Nodari
17-Jan-13 7:38am
View
OK but...
In the original code, no WHERE clause was present and SupplierCode was present two times inside the SET clause.
Did the error occur due to oneor both of these things, thus fixing them the error was resolved?
If so please mark the solution as correct; otherwise let us kindly know where was the problem.
Daniele Rota Nodari
17-Jan-13 2:54am
View
Hi.
I'm glad I was helpful. :)
About your other issue, have you assigned format "N2" to the DateTime column? This should be the only cause of the problem. Keep in mind that every type works with different format strings: "N2" is valid for some numerical types (like float) but not valid for others. For DateTime you have to use one of the default formats (e.g. "D") or custom formats (e.g. "dd-MM-yyyy").
If you still have problems, I suggest you to post another question on the forums in order to receive the best response possible and to share the solution with anyone else.
Regards, Daniele.
Daniele Rota Nodari
17-Jan-13 2:54am
View
Deleted
Hi.
I'm glad I was helpful. :)
About your other issue, have you assigned format "N2" to the DateTime column? This should be the only cause of the problem.
Keep in mind that every type works with different format strings: "N2" is valid for some numerical types (like float) but not valid for others.
For DateTime you have to use one of the default formats (e.g. "D") or custom formats (e.g. "dd-MM-yyyy").
If you still have problems, I suggest you to post another question on the forums in order to receive the best response possible and to share the solution with anyone else.
Regrads,
Daniele.
Daniele Rota Nodari
9-Jan-13 10:57am
View
You tell that you cannot call CWnd::UpdateData(FALSE)...
What is the reason you are telling that? Some compiler error? Or simply it seems not working?
Is dir_backup the CWnd (or CDialog, or derived one) object or some other class?
Daniele Rota Nodari
9-Jan-13 10:45am
View
Do you mean a kind of application that shows instead of the usual desktop and/or user login window.. a kind of application that replaces the default windows shell in order for the owner to provide a closed system where users can launch only a limited set of applications?
Or do you mean a user login replacement to customize only the user selection phase?
Daniele Rota Nodari
8-Jan-13 12:17pm
View
Yes, You are right, but velvet7 was not asking for the whole solution: he was asking for a way to find the solution by himself.. so I think he has exactly to find how to sort them... in order to complete the process within 7 steps.
I think that article can help him walk this way.
And about limits of humans and computer: this is a topic we can discuss really long. ;)
Daniele Rota Nodari
27-Dec-12 7:15am
View
You are looping j from ChunkSize to 1 and comparing it with World.ChunkSize / 2.
Are ChunkSize and World.ChunkSize in some way related?
What are current values for ChunkSize, ChunkY, World.ChunkSize?
Daniele Rota Nodari
27-Nov-12 10:05am
View
Why are you converting int to bool using Convert.ToBoolean ? You should directly test for the int value using ==,!=,<,>,<=,>= operators !
More.. I see a "switch (l%3)" with only "case 1" and "case 2", so case 0 is ignored: is it correct?
Daniele Rota Nodari
27-Nov-12 5:26am
View
The link you provided requires registration to the hosting site.
Would be better to choose another (lighter) hosting method.
Daniele Rota Nodari
27-Nov-12 5:20am
View
Is there any reference between the two forms? Is one of them the parent or owner of the other? Are their references stored somewhere?
In case none of this conditions are met You can use Application.OpenForms to find a reference to form1.
Then, if listbox is private (or protected) You should make it public (or internal) or add into form1 some method or property to forward access to it, or to its properties.
Daniele Rota Nodari
27-Nov-12 5:15am
View
Your code does not work as expected because ShowDialog makes frm2 modal, preventing the Close call to be reached until frm2 gets closed.
The solution provided by NeelmaniN work around this behavior by displaying frm2 as non-modal.
Beware that as being non-modal, other forms inside the same application can be used while frm2 being still shown.
Daniele Rota Nodari
12-Nov-12 6:09am
View
Compare dates converted to string format is culture dependent, and thus is likely to not work in many cultures
Daniele Rota Nodari
8-Oct-12 4:08am
View
Hi. Your question is not clear to me.
- You say that You need to set focus by pressing "TAB" manually: do you mean that the final user will simply hit the TAB key?
- You say that SetFocus does not work as expected, but the "default function" is working. What is this default function?
Show More