16,012,223 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 .NET 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 SteveBaldwin21 (Top 30 by date)
SteveBaldwin21
15-Sep-13 15:18pm
View
The problem I see is the collection modified during enumeration when adding the new images.
SteveBaldwin21
18-Aug-13 18:27pm
View
Haha. An Asynchronous operation then.:)
SteveBaldwin21
12-Aug-13 8:54am
View
<pre lang="cs">for (int i = 0; i < PlantCount; i++)
{
_PlantCollection.Add(new PlantCollection()
{
Name = _ListOfPlantNames[i],
URLOfPlant = ListOfURLs()[i],
PlantThumbnail = new BitmapImage(new Uri(ListOfImageSources()[i])),
SafeToFeed = ListOfSafeText()[i],
PlantTrafficColour = ListOfTrafficColours()[i]
});
}</pre>
<pre>PlantListView.ItemsSource = _PlantCollection;</pre>
^^ My listview that displays the plants in the UI.
If the PlantCount is null/0/empty - no items are shown in the Listview. If no Listview items are shown this is an indication that the PlantCount has 0 as a value in the loop, because if I add a value instead of the PlantCount it works as intended.
Hope this makes sense?
Thank you.
SteveBaldwin21
12-Aug-13 8:46am
View
This answer worked. Thank you very much David.
SteveBaldwin21
12-Aug-13 8:37am
View
I see on my question I had wrote the return inside the loop, my apologies as this was not in my code. This happened when I was trying to adjust the formatting in the "<pre>" section. I will try the code below and thank you!.
SteveBaldwin21
12-Aug-13 8:36am
View
sorry - I mean null rather than 0. No items appear in the listbox meaning that the loop is not iterating because the count is null.
Sorry again.
SteveBaldwin21
12-Aug-13 8:31am
View
Yep, its called when the list's are assigned to one. Yes the xpath is correct as the values are all correct. It's just I need the count to iterate how many plants to add to the ListView without causing duplication.
SteveBaldwin21
12-Aug-13 8:25am
View
I did and it passed a value of 0.
SteveBaldwin21
12-Aug-13 7:09am
View
Ignore this. I made a copy of the list so that it would not directly affect it.
Thank you anyway!
SteveBaldwin21
12-Aug-13 6:43am
View
Oh! Sorry, Thank you!
SteveBaldwin21
12-Aug-13 6:37am
View
Thank you for the reply. I tried this but VS2010 did not recongize the Container.PlantCollection?
SteveBaldwin21
9-Aug-13 20:27pm
View
Thank you for your reply. Very informative with the practical approach.
SteveBaldwin21
9-Aug-13 20:25pm
View
I have had a few replies with great answers that will help me greatly. I have not stated that anyone is trying to claim a programming paradigm is superior to another, actually the opposite. I was not fully aware of the logical approach of the structured to object which I will begin to incorporate. Again naivety from a newbie showing :(.
Thank you.
SteveBaldwin21
9-Aug-13 20:11pm
View
Brilliant answer and thank you. The last paragraph made perfect sense to my situation.
For example in my parser program. I have three classes following the SPR -
i. WebContentHandler - which principle is to 'handle' the WebRequest functions.
ii. Parser - which principle is to parse then assign the parsed data into generics.
iii. ParsedCollections - which contains the properties and methods of the generics that are passed to the UI/Databinding.
Still with this example and my structure, I find it is not very OOP at all... and the naming is not very 'real world' at all. Even still procedural would be so much simpler - even with tons more code. I just need to keep on reading and learning.
SteveBaldwin21
5-Aug-13 12:44pm
View
Just seen this! Didn't realise it had a multiple overload.
Thank you!
SteveBaldwin21
5-Aug-13 8:27am
View
Thank you, your suggestion did work in a single instance but when in a loop it returns incorrect values.
SteveBaldwin21
5-Aug-13 8:09am
View
I have updated the question, thank you.
It works in a single instance however when in a Foreach loop, it returns values;
0
-1
-1
-1
-1
-1
0
0
SteveBaldwin21
1-Jul-13 18:39pm
View
I have been reading most the afternoon on the DRY and SOLID concepts and will completely review my design.
I thank you very much for your advice and help + the kick up the ass to realise mistakes and learn correctly.
Thank you for your time Sergey.
SteveBaldwin21
1-Jul-13 16:10pm
View
I would love to, but only if you have time to answer it would be greatly appreciated.
1. My concern with using the class constructor is that, if I increase the amount of parameters on the constructors say for an image, this is going to be quite a lengthy code for each weed purely in the constructor parameters, Seeing as there could 100+ weeds.
2. DRY problem; for each of the weeds, I have the properties passed to a textblock in the form, which results in a large number of repetitive code. What could I do to avoid this? Could a solution be;
For the list_box conditional statements override the properties with 1 instantiation..
Weed WeedItem = new Weed(...)
but then it is still repeating everything again...
Hope this made sense.
Thank you
SteveBaldwin21
1-Jul-13 15:43pm
View
This made sense also, again thank you for taking the time to answer my question. I have become a bit stumped on how to approach this after this information.
SteveBaldwin21
1-Jul-13 15:22pm
View
Perfect example and explanation, thank you.
SteveBaldwin21
1-Jul-13 14:57pm
View
"#2: I would most certainly NOT use a method "Chicory" because it does not describe what it does and you would get a method for each new weed."
For what reason would methods be worse than the class constructors for each weed.
Weeds Chicory = new Weeds(...)
Weeds Dandelion = new Weeds(...)
etc..
Thank you
SteveBaldwin21
1-Jul-13 13:36pm
View
Thank you for your reply Sergey, I understood some of your reply but found the last part quite confusing.
"Hard-coding as you demonstrated it is simply not acceptable."
If you have the time please could you point me or explain with an example of hard-coding and how I am using it also why it is unacceptable.
Again thank you for your time.
SteveBaldwin21
1-Jul-13 8:50am
View
Thank you for the this reply, very informative.
"#4 Edible is Yes/No ? use a Boolean"
Edible - "Yes, Stems Only" or "Yes, Flowers Only" for example.
Thank you again.
SteveBaldwin21
1-Jul-13 7:56am
View
Sorry might not of been so clear; Properties and Chicory() are within (Public Class Weed) and the Use examples are within the Windows Form.
Edible and Regularity will contain more information but for these examples I just kept "Yes" and "Moderate".
SteveBaldwin21
28-Jun-13 14:39pm
View
Thank you! That worked perfectly.
SteveBaldwin21
27-Jun-13 16:17pm
View
Thank you CHill60.
SteveBaldwin21
27-Jun-13 16:17pm
View
Thank you for the bullet points very informative.
I had confused a constructor with a method and I caused myself much confusion; This really helped me understand Constructors though.
Thanks all for the replies.
SteveBaldwin21
27-Jun-13 15:06pm
View
"Doing less is catastrophic, doing more is bad."
I would be very grateful if you could take the time and elaborate on this.
Thank you!
SteveBaldwin21
27-Jun-13 15:04pm
View
Ah I see, this made sense.
I did misunderstand what the book said completely, or at least how I understood it was intended.
So just playing on example of the database write scenario; what would the negative effect of calling a constructor to write data.
Show More