15,881,882 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 C++ questions
View Javascript questions
View Visual Basic questions
View Python 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 Chris Ross 2 (Top 35 by date)
Chris Ross 2
6-Dec-16 6:46am
View
My three stars - in general the idea is fine.
Regarding use of 'ref' - given that the exception message is only ever outbound, I would recommend 'out', not 'ref'.
Regarding (in the caller) testing for !ExceptionMsg.Equals("") I would play it a little safer, with !string.IsNullOrWhiteSpace(ExceptionMsg) ... which still tests for empty strings but also for null and strings that have no meaningful content (i.e. are all white space).
Chris Ross 2
1-Feb-16 6:34am
View
If you're asking whether anyone can help you with the problem, the short answer is clearly no :) SOMEone can, but definitely not ANYone. But asking about the state of the world is a question that belongs in the lounge, not in quick answers. (Being a linguistic pedant I'd recommend, if you actually want help, rephrasing your question: "Would someone who can, please help me..." - but to suggest you do that would be rude, so I won't).
As to actual help:
You need to break your problem down into its constituent parts: (1) identifying a column that contains two or more cells with identical values, and (2) how to hilight the column (and how to remove the hilight if a column no longer has duplicates).
With which part are you having difficulties, and what have you tried so far? (I see what your replied to D@nish of what you found online being about rows ... but what have you actually tried?)
Chris Ross 2
29-Jan-16 8:24am
View
I trust you've run your code in the debugger - and have confirmed that execution arrives at your TextChange() method. If it does, then the problem lies in the construction of UserControl1; if it doesn't, the problem lies in the code of Form1 or Form2.
To help you more, it would be helpful to see the XAML of UserControl1.
Chris Ross 2
25-Jan-16 9:09am
View
First - your Google Drive links don't work - because they require the viewer to be signed in.
Second, have you run your code in the debugger to see what is going on?
You have a loop there that adds Tran objects to the Item object - perhaps you have more rows in the dataGridView1 than you expected?
Or, perhaps the item.Trans collection already has an element, for some reason that you weren't expecting, so adding one from the dataGridView1 results in a collection with two elements?
Chris Ross 2
25-Jan-16 9:03am
View
Maybe I missed it scanning the previous comments - but I didn't see any mention of what specific publish method you are using. So - I'll assume you're using the (very obvious and natural to use) Publish tab in the visual studio project settings ... which is Click Once publishing.
On that assumption, have you clicked the Application Files... button (on the Publish tab)? In the popup, tick the Show All tick box, and find your XML file in the file list. Make sure it's Publish Status is Include (I'm guessing it will not be 'Include (Auto)').
Hope that helps.
Chris Ross 2
25-Jan-16 8:56am
View
Have you tried running your code in a debugger ... and seeing what line is throwing the exception?
In the debugger Exceptions dialog (from the Visual Studio Debug menu), tick the 'thrown' column for Common Language Runtime Exceptions - that will make the debugger break when it throws the exception.
The debugger will break on the line that threw the exception - you can now inspect all the variables (and their parts) to see which one is null.
Chris Ross 2
25-Jan-16 8:50am
View
Have your customers specified what digital receivers they want you to use? Or, have you researched what receivers are available, and at an accepted price?
That would be the first place to start.
If you find any that are designed to connect to a computer I expect their manufactures supply an API you can use from your program. Then, study the API documentation to figure out how to control the receiver / consume its output.
If the manufacturers don't supply an API then you have a bunch of fun on your hands - figuring out how to drive whatever hardware interface the computer has that the receiver will connect with. The details of that will be specific to the device and nobody here will be able to tell you what to do (although there will be plenty who can give you general guidance about driving a PC's I/O devices).
Chris Ross 2
6-Jan-16 8:52am
View
Have you looked at the call stack recorded in the exception?
Your RT class (notwithstanding Maciej's observation that your MyOrder ... expression relates to a different type) as presented is unlikely to throw a NullReferene exception - so perhaps there is something else going on that is not immediately obvious?
Chris Ross 2
16-Mar-15 11:15am
View
I can't say I'm anything like an expert on design patterns (wish I was, but that's another story). You might take a look at http://www.dofactory.com/net/decorator-design-pattern - which classifies the Visitor pattern and Decorator pattern as behavioural and structural, respectively. That may help you choose between them if you go the pattern route.
Principles I find that reliably guide me are cohesiveness and the Single Responsibility Principle - am I putting multiple distinct sets of behaviour into a single class? Which leads into an observation & question that you haven't quite asked for, but may be helpful:
As I look at the ideas you are working with (expressed tentatively as Contact, ContactWithTenancy, etc.) it occurs to me that you've put Contact first and foremost in your design problem (and the business relationship involving that is a secondary aspect of the model). Have you tried inverting that thought pattern? Landlord, Tenant, TenantWithGuarantor are, perhaps, the primary business objects - and contact information is just a property common to all business relationships in your model? If you need to, at times, treat Landlord, etc., as members of a common family, they could all implement an applicable interface.
If you've not yet explored design principles - I find http://en.wikipedia.org/wiki/SOLID_%28object-oriented_design%29 to be a useful starting point.
Chris Ross 2
16-Dec-14 9:54am
View
Have you read the data sheet for the EM4102? (http://www.google.co.uk/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=0CCEQFjAA&url=http%3A%2F%2Fwww.mcselec.com%2Ftiny%2Fdwn%2F193%2F54&ei=R0WQVPj4Kauy7Qa1soCAAg&usg=AFQjCNFZCEhbONWVUP9k69STcHYxUSVogQ&bvm=bv.81828268,d.ZGU&cad=rja)
I took a quick look at it, and at a guess the 'hex' number you show above is maybe a hex representation of a bit stream the device outputs? In the data sheet, notice that "Data can be codes as Manchester, Biphase or PSK" (page 1). I think it also carries a parity bit (page 5). Now, whatever device you are using to read the EM device probably handles the encoding/decoding ... but maybe it's up to you to strip the parity?
Chris Ross 2
19-Aug-14 5:34am
View
Does the Oracle toolset provide a means of watching what SQL is submitted from applications? If so, you could run the offending code and see what SQL is generated, that ultimately causes that exception.
Another line of investigation would be to see if Entity Framework (which, I'm inferring you're using) has a means of discovering the SQL it generates.
Sorry I don't have a concrete solution - I work more with MS SqlServer & the plain vanilla ADO.Net objects.
Chris Ross 2
19-Aug-14 5:28am
View
ARe the rows in tables 1 & 2 correlated .. such that decisions about row X in table 1 lead to a data change in row X of table 2? If so, I would recommend using a for () loop and index, not a foreach loop.
Chris Ross 2
17-Jan-14 9:33am
View
I think that what you are doing with reflection is what I was thinking about regarding programmatically specifying the columns.
I suspect that the disconnect between us is that I was picturing your BO as having Time a fixed set of other properties, whereas how you've defined it currently is Time + dictionary.
Hmm. I think I've understood your data structure ... and I'm stumped as to how to do what I think you want to do (namely - have different DGVs bind to a common BO, but each referencing a different element in the Value dictionary).
I wonder if the binding object is extensible. The problem as I see it is that the DGV expects to bind to an atomic value (string, int, DateTime, etc.) but you're presenting it with a dictionary and wanting it to present/edit the value of one element in that dictionary.
You may have to write a custom binding class that takes the ValueName and the Value dictionary, and yields to the DGV a property that is the specific value element desired. Look at MSDN for the Binding class OnFormat and OnParse methods.
Chris Ross 2
17-Jan-14 7:14am
View
Unless you have a specific need for ITime, you don't need that interface. Identical properties (and methods) can be declared on multiple interfaces - and all map to the same actual property (or method) on the class that implements the item. So, you can declare the Time property in both of the IValueSetX interfaces and in eac hcase it'll refer to the Time property on the actual class. With that change your DVGs don't need to look for multiple interfaces, they each just relate to a single interface.
Unfortunately, however, I must have overlooked the fact that your application needs things to be dynamic. That changes things. (Although in principal you could dynamically emit new code for dynamically designed interfaces, that's seriously advanced stuff and really only belongs in the world of compilers. It's not something for an end-user application to do.)
The need for an unknown (at compile time) set of variants means my idea won't work (unless you create interfaces for all combinations of Time + one other property ... and that seems ugly and isn't flexible).
Since you are dynamically creating DGVs you must have some way of knowing which property (+ Time) is to be associated with a DGV. I recommend (a) forget my idea of interfaces; (b) assign your Collection<BO> to the data source of each DGV, and, importantly, (c) programatically specify the columns to be presented in the DGV (i.e. don't use the automatically created set of columns the DGV creates for you).
Chris Ross 2
15-Jan-14 4:56am
View
Re needing different sets of properties for the various DGVs - have you considered creating interfaces that express the column sets you require in your DGVs(one interface for each distinct set of columns)? Then, when the DGV does its reflection it should reflect on the type exposed (the interface) not the underlying type (the BO type).
Your BO then implements each interface. Here's some sample code for creating Collections you can pass to the various DGVs:
namespace DGVPlay
{
public partial class Form1 : Form
{
private readonly Collection<Data> m_myData = new Collection<Data>();
public Form1()
{
InitializeComponent();
Collection<ISubset1> s1 = new Collection<ISubset1>(m_myData.Select(d => (ISubset1)d).ToList());
Collection<ISubset2> s2 = new Collection<ISubset2>(m_myData.Select(d => (ISubset2)d).ToList());
}
}
public class Data : ISubset1, ISubset2
{
public int Id { get; set; }
public string Name { get; set; }
public DateTime DOB { get; set; }
public int SomeOtherThing { get; set; }
}
interface ISubset1
{
string Name { get; set; }
DateTime DOB { get; set; }
}
interface ISubset2
{
string Name { get; set; }
int SomeOtherThing { get; set; }
}
}
Chris Ross 2
9-Dec-13 9:46am
View
Re implementing a count of your population - whenever a new person is created, add it to a collection (class Population {...}). Whenever someone dies, remove if from the Population class (and add it to one or more of the Ghosts, Undead, Ascended, MerelyDead, Saints, FoodForWorms, etc. classes :) ).
So that you don't have references all over the place to the Population class, make the creation and death of a person static members of your Person class; those methods can then update the Population class. ... or - just have a static property TotalPopulation on the Person class; simpler if a little less OO clean.
Chris Ross 2
9-Dec-13 9:38am
View
Your code doesn't seem to have any logic that relates to probability ... which makes it hard to make suggestions for using different probabilities. If you provide some more explanation someone might be able to help.
Chris Ross 2
4-Nov-13 9:35am
View
Your text books should show you how to create functions. Or, your professor can direct you towards suitable reference information.
Regrettably, if you don't know how to create a function in your chosen programming language, you have more fundamental problems to resolve than choosing the best place to declare a variable. And, although Code Project readers like to be able to help each other, we're not in the position to be teaching the fundamentals of programming - and explaining how to write a function falls squarely into that category.
Chris Ross 2
18-Oct-13 8:16am
View
Sounds like you already know more than me about SSRS & PDF. Best of luck with the fallback font!
If you wouldn't mind posting a comment describing what you discover, that would be helpful to any who stumble across this conversation facing similar issues.
Chris Ross 2
17-Oct-13 11:18am
View
You need to tell us what you tried and what error you got.
Also, you've tagged this question as a .Net4 question - maybe you're using .Net, maybe you're not. The information you've given us has nothing to do with .Net4 and everything to do with the Facebook API. You might get more useful responses if you tag your question with an appropriate tag.
Chris Ross 2
17-Oct-13 11:14am
View
It's nice that you want to do a thing; telling us about it, however, is rarely going to get you any help. You will most likely only get useful responses when you actually ask a question.
Furthermore, it will also help if you demonstrate what you have already done in trying to solve your problem. While pretty much everybody here is glad to help if they can, nobody likes to be asked to do your work for you.
Chris Ross 2
20-Sep-13 11:09am
View
This is not a question about c#; please don't include the tag unless it is relevant. Thanks.
Chris Ross 2
20-Sep-13 11:06am
View
Assuming that you're referring to XmlNode.SelectNodes(), you're spot on. Note that XmlDocument inherits XmlNode - and is handy for loading XML in a string, or from a file, into memory.
Since you're already aware of SelectNodes, it would appear that it doesn't meet your needs, or it doesn't make sense to you ... that you haven't included in your question (although, I guess maybe you're simply asking for confirmation that it's the equivalent method).
Is there anything about SelectNodes that isn't working for you?
Chris Ross 2
24-Jun-13 12:40pm
View
You may need to provide a little more information than "per printer page layout settings."
I am guessing that you mean portrait/landscape and margin settings - so that you can determine the maximum area that will fit on a page. But that's only a guess: you may have something completely different in mind!
If you update your question you'll have a better chance of an answer!
Chris Ross 2
17-Jun-13 9:15am
View
Very good point!
Chris Ross 2
1-Nov-12 11:02am
View
It would also help if you included information about the Bank class - in particular the r200 and r100 property declarations.
If you went further to include information about the database data type of the columns that become items 2 and 3 in your data reader, that would also help.
Chris Ross 2
19-Sep-12 11:38am
View
Sadly I've never actually set up an app for Click Once, so I can't share any wisdom. Google is perhaps your friend for learning how to set it up.
We do use Click Once for the deployment of the app I work with, and we use web deployment (but it was set up before I arrived).
Here are the settings (publish tab of the project) - which perhaps will shed some light:
Publishing folder location: \\intranet01\d$\wwwroot\SomeWebSiteName\TheAppName\
Installation folder URL: http://SomeWebSiteName/
* The app is available offline as well.
Hope that helps.
Chris Ross 2
23-May-12 12:20pm
View
Umm... it mostly works. But, it missed out the ', ' buried in the middle of the string.
Chris Ross 2
23-May-12 11:47am
View
Unfortunately the OP cannot sort on the source data because it is just the name/country text - without the appended '[nnn]'. And he wants to sort on the 'nnn'.
Chris Ross 2
17-Apr-12 5:31am
View
Please forgive me for misunderstanding your difficulty!
This appears to be a matter of understanding MS Access and how it interprets date literals. You'll have to dig into the MS Access documentation to discover that.
You should also read about "parameterised queries" - the approved means of supplying parameters to SQL queries when accessing a database from C#. Using parameterised queries means that you won't have to format your dates as a string - the database access layer of the .Net runtime does that for you (you supply your DateTime C# object(s) as the value to the query's parameter(s)).
Now - I've not used MS Access from a .Net app so I'm making a big assumption that what I can do against MS SqlServer is closely analogous to what you can do with MS Access. Hopefully that's not an invalid assumption!
Chris Ross 2
15-Feb-12 5:35am
View
What I had understood from your question (perhaps I was wrong?) was that this task of merging the various databases would be a one-off event. With that in mind I had assumed that you would write a small, distinct, app which existed just to do the merge - and you would have all the various database files already at your disposal, to copy into a temp directory, or whatever.
If you need this behaviour built into your main app, perhaps making 'merging databases' a user-selectable function on a menu would be appropriate. When they pick this function, it prompts the user to specify the location of the second database (and would merge that one into the 'first' database - which is the one the app already knows about and, presumably, is configured to use on startup).
Chris Ross 2
18-Jan-12 13:48pm
View
Have you considered using a mixed environment? By that, I mean - use C++ for the algorithm (which I presume is "pure processing" - i.e. no user interface interaction) - and use C# for the user interface (visual forms management).
VS2010 allows you to create assemblies (DLLs) in different languages, and have them work together. So, you could create a managed C++ assembly to carry your algorithm, and create the main application in C# - which would reference (link to) the C++ assembly.
Chris Ross 2
10-Jan-12 4:33am
View
Deleted
I would recommend not including the BindingFlags.Static flag ... you are invoking InitDefaults() in every instance constructor; with the flag included you will reset your static properties to their default values every time you instantiate a new instance of the class.
Perhaps give InitDefaults a parameter to select static vs. instance mode, and call it from the static constructor of the type as well as from the instance constructor?
Chris Ross 2
20-Dec-11 7:44am
View
Deleted
I agree, that paying attention to the logic behind the program is important - and I imagine that the logic was in the forefront of your thoughts when you posted the article. In that context, my comment was essentially off-topic, and I apologise for not properly introducing my feedback.
I'll strongly disagree, however, that attending to the variables' names is less important - although I'll acknowledge that their importance arises from a different context. Variable (and method and class) names are crucial to creating quality software. Poorly named entities (a) make it hard for a reader to understand the code being studied, and (b) make it hard for all, original author or reader, to ensure correctness: without clear and precise names the purpose of an object, method or variable cannot be solidly grasped and, in turn, the correctness of the related code is hard to validate.
If you truly want to help beginner coders (.Net or otherwise) then presenting coding practices that are recognised as being valuable would surely be a worthy thing to do.
If there are books that still use one character variable names, or any other kind of meaningless names, then we have an even stronger duty to present examples of the use of meaningful names, so that their utility can be noticed.
Note: I picked on 'ans' (for 'answer', I presume) because it is meaningless in the context of the algorithm - which is why I proposed 'magicSquare'. ('Answer' is a use-centric concept, which has no value or meaning at the algorithm level.) Sure, this is a trivial program and in this context it is obvious that the array is the magic square; however, in the context of teaching beginners good practices, an algorithm-centric name is likely to be more useful.
Chris Ross 2
20-Dec-11 5:17am
View
Deleted
Reason for my vote of 2
I'll add to the previous dissatisfaction about the lack of comments with this: variable names such as 's', 'n', 'i', 'j' went out with the ark - we now have systems that can accommodate variables with names that are informative. Note - even 'ans' could reasonably be named 'magicSquare'.
Show More